Class: BeeiqAPI::Contact
- Inherits:
-
Object
- Object
- BeeiqAPI::Contact
- Defined in:
- lib/beeiq_api/contact.rb
Instance Attribute Summary collapse
-
#addresses ⇒ Object
Returns the value of attribute addresses.
-
#company_contact ⇒ Object
Returns the value of attribute company_contact.
-
#contact_type ⇒ Object
Returns the value of attribute contact_type.
-
#cus_fields ⇒ Object
Returns the value of attribute cus_fields.
-
#date_of_birth ⇒ Object
Returns the value of attribute date_of_birth.
-
#emails ⇒ Object
Returns the value of attribute emails.
-
#gender ⇒ Object
Returns the value of attribute gender.
-
#im ⇒ Object
Returns the value of attribute im.
-
#lastname ⇒ Object
Returns the value of attribute lastname.
-
#name ⇒ Object
Returns the value of attribute name.
-
#passport ⇒ Object
Returns the value of attribute passport.
-
#phones ⇒ Object
Returns the value of attribute phones.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Contact
constructor
A new instance of Contact.
- #payload ⇒ Object
- #payload_raw ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Contact
Returns a new instance of Contact.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/beeiq_api/contact.rb', line 18 def initialize( = {}) @contact_type = [:contact_type] || Config::ContactType::CUSTOMER @name = [:name] @lastname = [:lastname] @title = [:title] @passport = [:passport] @gender = [:gender] @date_of_birth = [:date_of_birth] @emails = [:emails] @phones = [:phones] @addresses = [:addresses] @im = [:im] @tag = [:tag] @cus_fields = [:cus_fields] @company_contact = [:company_contact] raise ArgumentError, 'name is required' if @name.to_s.empty? end |
Instance Attribute Details
#addresses ⇒ Object
Returns the value of attribute addresses.
12 13 14 |
# File 'lib/beeiq_api/contact.rb', line 12 def addresses @addresses end |
#company_contact ⇒ Object
Returns the value of attribute company_contact.
16 17 18 |
# File 'lib/beeiq_api/contact.rb', line 16 def company_contact @company_contact end |
#contact_type ⇒ Object
Returns the value of attribute contact_type.
3 4 5 |
# File 'lib/beeiq_api/contact.rb', line 3 def contact_type @contact_type end |
#cus_fields ⇒ Object
Returns the value of attribute cus_fields.
15 16 17 |
# File 'lib/beeiq_api/contact.rb', line 15 def cus_fields @cus_fields end |
#date_of_birth ⇒ Object
Returns the value of attribute date_of_birth.
9 10 11 |
# File 'lib/beeiq_api/contact.rb', line 9 def date_of_birth @date_of_birth end |
#emails ⇒ Object
Returns the value of attribute emails.
10 11 12 |
# File 'lib/beeiq_api/contact.rb', line 10 def emails @emails end |
#gender ⇒ Object
Returns the value of attribute gender.
8 9 10 |
# File 'lib/beeiq_api/contact.rb', line 8 def gender @gender end |
#im ⇒ Object
Returns the value of attribute im.
13 14 15 |
# File 'lib/beeiq_api/contact.rb', line 13 def im @im end |
#lastname ⇒ Object
Returns the value of attribute lastname.
5 6 7 |
# File 'lib/beeiq_api/contact.rb', line 5 def lastname @lastname end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/beeiq_api/contact.rb', line 4 def name @name end |
#passport ⇒ Object
Returns the value of attribute passport.
7 8 9 |
# File 'lib/beeiq_api/contact.rb', line 7 def passport @passport end |
#phones ⇒ Object
Returns the value of attribute phones.
11 12 13 |
# File 'lib/beeiq_api/contact.rb', line 11 def phones @phones end |
#tag ⇒ Object
Returns the value of attribute tag.
14 15 16 |
# File 'lib/beeiq_api/contact.rb', line 14 def tag @tag end |
#title ⇒ Object
Returns the value of attribute title.
6 7 8 |
# File 'lib/beeiq_api/contact.rb', line 6 def title @title end |
Instance Method Details
#payload ⇒ Object
56 57 58 |
# File 'lib/beeiq_api/contact.rb', line 56 def payload payload_raw.delete_if { |k, v| v.nil? || (!v.kind_of?(Integer) && v.empty?) } end |
#payload_raw ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/beeiq_api/contact.rb', line 37 def payload_raw { contactType: @contact_type, name: @name, lastname: @lastname, title: @title, passport: @passport, gender: @gender, dateOfBirth: @date_of_birth, emails: @emails, phones: @phones, addresses: @addresses, im: @im, tag: @tag, cusFields: @cus_fields, companyContact: @company_contact } end |