Class: ConstantContact::Components::Contact

Inherits:
Component
  • Object
show all
Defined in:
lib/constantcontact/components/contacts/contact.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Component

#to_hash, to_hash_value, #to_json

Instance Attribute Details

#addressesObject

Returns the value of attribute addresses



11
12
13
# File 'lib/constantcontact/components/contacts/contact.rb', line 11

def addresses
  @addresses
end

#cell_phoneObject

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_nameObject

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

#confirmedObject

Returns the value of attribute confirmed



11
12
13
# File 'lib/constantcontact/components/contacts/contact.rb', line 11

def confirmed
  @confirmed
end

#created_dateObject

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_fieldsObject

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_addressesObject

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

#faxObject

Returns the value of attribute fax



11
12
13
# File 'lib/constantcontact/components/contacts/contact.rb', line 11

def fax
  @fax
end

#first_nameObject

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_phoneObject

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

#idObject

Returns the value of attribute id



11
12
13
# File 'lib/constantcontact/components/contacts/contact.rb', line 11

def id
  @id
end

#job_titleObject

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_nameObject

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

#listsObject

Returns the value of attribute lists



11
12
13
# File 'lib/constantcontact/components/contacts/contact.rb', line 11

def lists
  @lists
end

#middle_nameObject

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_dateObject

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

#notesObject

Returns the value of attribute notes



11
12
13
# File 'lib/constantcontact/components/contacts/contact.rb', line 11

def notes
  @notes
end

#prefix_nameObject

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

#sourceObject

Returns the value of attribute source



11
12
13
# File 'lib/constantcontact/components/contacts/contact.rb', line 11

def source
  @source
end

#source_detailsObject

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

#statusObject

Returns the value of attribute status



11
12
13
# File 'lib/constantcontact/components/contacts/contact.rb', line 11

def status
  @status
end

#work_phoneObject

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

Parameters:

  • props (Hash)
    • properties to create object from

Returns:



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

Parameters:



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

Parameters:



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

Parameters:



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