Class: Puzzle::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/puzzle/contact.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(contact_info) ⇒ Contact

Returns a new instance of Contact.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/puzzle/contact.rb', line 24

def initialize(contact_info)
  @company_id = contact_info["companyId"]
  @id = contact_info["contactId"]
  @title = contact_info["title"]
  @company_name = contact_info["companyName"]
  @updated_at = contact_info["updatedDate"]
  @graveyard_status = contact_info["graveyardStatus"]
  @firstname = contact_info["firstname"]
  @lastname = contact_info["lastname"]
  @city = contact_info["city"]
  @state = contact_info["state"]
  @country = contact_info["country"]
  @zip = contact_info["zip"]
  @url = contact_info["contactUrl"]
  @area_code = contact_info["areaCode"]
  @phone = contact_info["phone"]
  @email = contact_info["email"]
  @address = contact_info["address"]
  @owned = contact_info["owned"]
  @owned_type = contact_info["ownedType"]
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



19
20
21
# File 'lib/puzzle/contact.rb', line 19

def address
  @address
end

#area_codeObject

Returns the value of attribute area_code.



16
17
18
# File 'lib/puzzle/contact.rb', line 16

def area_code
  @area_code
end

#cityObject

Returns the value of attribute city.



11
12
13
# File 'lib/puzzle/contact.rb', line 11

def city
  @city
end

#company_idObject

Returns the value of attribute company_id.



3
4
5
# File 'lib/puzzle/contact.rb', line 3

def company_id
  @company_id
end

#company_nameObject

Returns the value of attribute company_name.



6
7
8
# File 'lib/puzzle/contact.rb', line 6

def company_name
  @company_name
end

#countryObject

Returns the value of attribute country.



13
14
15
# File 'lib/puzzle/contact.rb', line 13

def country
  @country
end

#emailObject

Returns the value of attribute email.



18
19
20
# File 'lib/puzzle/contact.rb', line 18

def email
  @email
end

#firstnameObject

Returns the value of attribute firstname.



9
10
11
# File 'lib/puzzle/contact.rb', line 9

def firstname
  @firstname
end

#graveyard_statusObject

Returns the value of attribute graveyard_status.



8
9
10
# File 'lib/puzzle/contact.rb', line 8

def graveyard_status
  @graveyard_status
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/puzzle/contact.rb', line 4

def id
  @id
end

#lastnameObject

Returns the value of attribute lastname.



10
11
12
# File 'lib/puzzle/contact.rb', line 10

def lastname
  @lastname
end

#ownedObject

Returns the value of attribute owned.



20
21
22
# File 'lib/puzzle/contact.rb', line 20

def owned
  @owned
end

#owned_typeObject

Returns the value of attribute owned_type.



21
22
23
# File 'lib/puzzle/contact.rb', line 21

def owned_type
  @owned_type
end

#phoneObject

Returns the value of attribute phone.



17
18
19
# File 'lib/puzzle/contact.rb', line 17

def phone
  @phone
end

#stateObject

Returns the value of attribute state.



12
13
14
# File 'lib/puzzle/contact.rb', line 12

def state
  @state
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/puzzle/contact.rb', line 5

def title
  @title
end

#updated_atObject

Returns the value of attribute updated_at.



7
8
9
# File 'lib/puzzle/contact.rb', line 7

def updated_at
  @updated_at
end

#urlObject

Returns the value of attribute url.



15
16
17
# File 'lib/puzzle/contact.rb', line 15

def url
  @url
end

#zipObject

Returns the value of attribute zip.



14
15
16
# File 'lib/puzzle/contact.rb', line 14

def zip
  @zip
end

Class Method Details

.find(options) ⇒ Object

Return a list of contacts

> pageSize: The attribute specifies the maximum number of records to be returned in a request. The system limit and default value is 500.

> firstname: firstname of the contact to be searched

> lastname: last (or family) name of the contact to be searched

> levels: employee rank (e.g. VP, Staff)

> companyName: company for whom contact works (indexed to include Company Name, URL, and ticker symbol)

> email: full email address of the contact to be searched

> View developer.jigsaw.com/documentation/search_and_get_api_guide/6_Data_Keys_and_Values for available search parameter



54
55
56
57
58
59
60
61
# File 'lib/puzzle/contact.rb', line 54

def self.find(options)
  contacts = []
  result = Puzzle::Request.get("/searchContact", options)
  result["contacts"].each do |contact|
    contacts << new(contact)
  end
  contacts
end