Class: ConstantContact::Components::Contact
- Defined in:
- lib/constantcontact/components/contacts/contact.rb
Instance Attribute Summary collapse
-
#addresses ⇒ Object
Returns the value of attribute addresses.
-
#cell_phone ⇒ Object
Returns the value of attribute cell_phone.
-
#company_name ⇒ Object
Returns the value of attribute company_name.
-
#confirmed ⇒ Object
Returns the value of attribute confirmed.
-
#created_date ⇒ Object
Returns the value of attribute created_date.
-
#custom_fields ⇒ Object
Returns the value of attribute custom_fields.
-
#email_addresses ⇒ Object
Returns the value of attribute email_addresses.
-
#fax ⇒ Object
Returns the value of attribute fax.
-
#first_name ⇒ Object
Returns the value of attribute first_name.
-
#home_phone ⇒ Object
Returns the value of attribute home_phone.
-
#id ⇒ Object
Returns the value of attribute id.
-
#job_title ⇒ Object
Returns the value of attribute job_title.
-
#last_name ⇒ Object
Returns the value of attribute last_name.
-
#lists ⇒ Object
Returns the value of attribute lists.
-
#middle_name ⇒ Object
Returns the value of attribute middle_name.
-
#modified_date ⇒ Object
Returns the value of attribute modified_date.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#prefix_name ⇒ Object
Returns the value of attribute prefix_name.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_details ⇒ Object
Returns the value of attribute source_details.
-
#status ⇒ Object
Returns the value of attribute status.
-
#work_phone ⇒ Object
Returns the value of attribute work_phone.
Class Method Summary collapse
-
.create(props) ⇒ Contact
Factory method to create a Contact object from a json string.
Instance Method Summary collapse
-
#add_address(address) ⇒ Object
Setter.
-
#add_email(email_address) ⇒ Object
Setter.
-
#add_list(contact_list) ⇒ Object
Setter.
Methods inherited from Component
#to_hash, to_hash_value, #to_json
Instance Attribute Details
#addresses ⇒ Object
Returns the value of attribute addresses
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def addresses @addresses end |
#cell_phone ⇒ Object
Returns the value of attribute cell_phone
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def cell_phone @cell_phone end |
#company_name ⇒ Object
Returns the value of attribute company_name
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def company_name @company_name end |
#confirmed ⇒ Object
Returns the value of attribute confirmed
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def confirmed @confirmed end |
#created_date ⇒ Object
Returns the value of attribute created_date
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def created_date @created_date end |
#custom_fields ⇒ Object
Returns the value of attribute custom_fields
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def custom_fields @custom_fields end |
#email_addresses ⇒ Object
Returns the value of attribute email_addresses
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def email_addresses @email_addresses end |
#fax ⇒ Object
Returns the value of attribute fax
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def fax @fax end |
#first_name ⇒ Object
Returns the value of attribute first_name
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def first_name @first_name end |
#home_phone ⇒ Object
Returns the value of attribute home_phone
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def home_phone @home_phone end |
#id ⇒ Object
Returns the value of attribute id
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def id @id end |
#job_title ⇒ Object
Returns the value of attribute job_title
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def job_title @job_title end |
#last_name ⇒ Object
Returns the value of attribute last_name
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def last_name @last_name end |
#lists ⇒ Object
Returns the value of attribute lists
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def lists @lists end |
#middle_name ⇒ Object
Returns the value of attribute middle_name
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def middle_name @middle_name end |
#modified_date ⇒ Object
Returns the value of attribute modified_date
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def modified_date @modified_date end |
#notes ⇒ Object
Returns the value of attribute notes
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def notes @notes end |
#prefix_name ⇒ Object
Returns the value of attribute prefix_name
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def prefix_name @prefix_name end |
#source ⇒ Object
Returns the value of attribute source
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def source @source end |
#source_details ⇒ Object
Returns the value of attribute source_details
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def source_details @source_details end |
#status ⇒ Object
Returns the value of attribute status
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def status @status end |
#work_phone ⇒ Object
Returns the value of attribute work_phone
11 12 13 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 11 def work_phone @work_phone end |
Class Method Details
.create(props) ⇒ Contact
Factory method to create a Contact object from a json string
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 20 def self.create(props) obj = Contact.new if props props.each do |key, value| if key == 'email_addresses' if value obj.email_addresses = [] value.each do |email_address| obj.email_addresses << Components::EmailAddress.create(email_address) end end elsif key == 'addresses' if value obj.addresses = [] value.each do |address| obj.addresses << Components::Address.create(address) end end elsif key == 'notes' if value obj.notes = [] value.each do |note| obj.notes << Components::Note.create(note) end end elsif key == 'custom_fields' if value obj.custom_fields = [] value.each do |custom_field| obj.custom_fields << Components::CustomField.create(custom_field) end end elsif key == 'lists' if value obj.lists = [] value.each do |contact_list| obj.lists << Components::ContactList.create(contact_list) end end else obj.send("#{key}=", value) if obj.respond_to? key end end end obj end |
Instance Method Details
#add_address(address) ⇒ Object
Setter
85 86 87 88 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 85 def add_address(address) @addresses = [] if @addresses.nil? @addresses << address end |
#add_email(email_address) ⇒ Object
Setter
77 78 79 80 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 77 def add_email(email_address) @email_addresses = [] if @email_addresses.nil? @email_addresses << email_address end |
#add_list(contact_list) ⇒ Object
Setter
69 70 71 72 |
# File 'lib/constantcontact/components/contacts/contact.rb', line 69 def add_list(contact_list) @lists = [] if @lists.nil? @lists << contact_list end |