|
|
@ -4,7 +4,9 @@ class Person
|
|
|
|
def initialize(args = {})
|
|
|
|
def initialize(args = {})
|
|
|
|
@id = args[:id] || nil
|
|
|
|
@id = args[:id] || nil
|
|
|
|
@git = args[:git]
|
|
|
|
@git = args[:git]
|
|
|
|
validate
|
|
|
|
|
|
|
|
|
|
|
|
raise ArgumentError, "Git link is required" unless git_present?
|
|
|
|
|
|
|
|
raise ArgumentError, "At least one contact (phone, telegram, or email) is required" unless contact_present?
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def set_contacts(phone: nil, telegram: nil, email: nil)
|
|
|
|
def set_contacts(phone: nil, telegram: nil, email: nil)
|
|
|
@ -46,11 +48,6 @@ class Person
|
|
|
|
!(@phone.nil? || @phone.empty?) || !(@telegram.nil? || @telegram.empty?) || !(@email.nil? || @email.empty?)
|
|
|
|
!(@phone.nil? || @phone.empty?) || !(@telegram.nil? || @telegram.empty?) || !(@email.nil? || @email.empty?)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def validate
|
|
|
|
|
|
|
|
raise ArgumentError, "Git link is required" unless git_present?
|
|
|
|
|
|
|
|
raise ArgumentError, "At least one contact (phone, telegram, or email) is required" unless contact_present?
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def contact_info
|
|
|
|
def contact_info
|
|
|
|
return "Phone: #{@phone}" if @phone
|
|
|
|
return "Phone: #{@phone}" if @phone
|
|
|
|
return "Telegram: #{@telegram}" if @telegram
|
|
|
|
return "Telegram: #{@telegram}" if @telegram
|
|
|
|