Class: Jigsaw::ContactSearch
- Inherits:
-
Object
- Object
- Jigsaw::ContactSearch
- Defined in:
- lib/jigsaw/contact_search.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#areaCode ⇒ Object
Returns the value of attribute areaCode.
-
#city ⇒ Object
Returns the value of attribute city.
-
#companyId ⇒ Object
Returns the value of attribute companyId.
-
#companyName ⇒ Object
Returns the value of attribute companyName.
-
#contactId ⇒ Object
Returns the value of attribute contactId.
-
#contactSales ⇒ Object
Returns the value of attribute contactSales.
-
#contactURL ⇒ Object
Returns the value of attribute contactURL.
-
#country ⇒ Object
Returns the value of attribute country.
-
#email ⇒ Object
Returns the value of attribute email.
-
#firstname ⇒ Object
Returns the value of attribute firstname.
-
#graveyardStatus ⇒ Object
Returns the value of attribute graveyardStatus.
-
#lastname ⇒ Object
Returns the value of attribute lastname.
-
#owned ⇒ Object
Returns the value of attribute owned.
-
#ownedType ⇒ Object
Returns the value of attribute ownedType.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#seoContactURL ⇒ Object
Returns the value of attribute seoContactURL.
-
#state ⇒ Object
Returns the value of attribute state.
-
#title ⇒ Object
Returns the value of attribute title.
-
#updatedDate ⇒ Object
Returns the value of attribute updatedDate.
-
#zip ⇒ Object
Returns the value of attribute zip.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json_object) ⇒ ContactSearch
constructor
A new instance of ContactSearch.
Constructor Details
#initialize(json_object) ⇒ ContactSearch
Returns a new instance of ContactSearch.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jigsaw/contact_search.rb', line 9 def initialize(json_object) @zip = json_object['zip'] @phone = json_object['phone'] @areaCode = json_object['areaCode'] @updatedDate = json_object['updatedDate'] @seoContactURL = json_object['seoContactUR'] @state = json_object['state'] @lastname = json_object['lastname'] @firstname = json_object['firstname'] @companyName = json_object['companyName'] @contactURL = json_object['contactURL'] @contactSales = json_object['contactSales'] @country = json_object['country'] @owned = json_object['owned'] @city = json_object['city'] @title = json_object['title'] @contactId = json_object['contactId'] @email = json_object['email'] @address = json_object['address'] @graveyardStatus = json_object['graveyardStatus'] @ownedType = json_object['ownedType'] @companyId = json_object['companyId'] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def address @address end |
#areaCode ⇒ Object
Returns the value of attribute areaCode.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def areaCode @areaCode end |
#city ⇒ Object
Returns the value of attribute city.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def city @city end |
#companyId ⇒ Object
Returns the value of attribute companyId.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def companyId @companyId end |
#companyName ⇒ Object
Returns the value of attribute companyName.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def companyName @companyName end |
#contactId ⇒ Object
Returns the value of attribute contactId.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def contactId @contactId end |
#contactSales ⇒ Object
Returns the value of attribute contactSales.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def contactSales @contactSales end |
#contactURL ⇒ Object
Returns the value of attribute contactURL.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def contactURL @contactURL end |
#country ⇒ Object
Returns the value of attribute country.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def country @country end |
#email ⇒ Object
Returns the value of attribute email.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def email @email end |
#firstname ⇒ Object
Returns the value of attribute firstname.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def firstname @firstname end |
#graveyardStatus ⇒ Object
Returns the value of attribute graveyardStatus.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def graveyardStatus @graveyardStatus end |
#lastname ⇒ Object
Returns the value of attribute lastname.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def lastname @lastname end |
#owned ⇒ Object
Returns the value of attribute owned.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def owned @owned end |
#ownedType ⇒ Object
Returns the value of attribute ownedType.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def ownedType @ownedType end |
#phone ⇒ Object
Returns the value of attribute phone.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def phone @phone end |
#seoContactURL ⇒ Object
Returns the value of attribute seoContactURL.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def seoContactURL @seoContactURL end |
#state ⇒ Object
Returns the value of attribute state.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def state @state end |
#title ⇒ Object
Returns the value of attribute title.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def title @title end |
#updatedDate ⇒ Object
Returns the value of attribute updatedDate.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def updatedDate @updatedDate end |
#zip ⇒ Object
Returns the value of attribute zip.
7 8 9 |
# File 'lib/jigsaw/contact_search.rb', line 7 def zip @zip end |
Class Method Details
.list(api_key, options, fetch_all = false) ⇒ Object
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 66 67 68 69 70 71 72 73 |
# File 'lib/jigsaw/contact_search.rb', line 34 def self.list(api_key, , fetch_all=false) [:token] = api_key [:page_size] = [:page_size] || 50 # 50 is the default. [:offset] = [:offset] || 0 # 0 is the default. # Camelize options = {} .each do |key, value| [key.to_s.camelize(:lower)] = value end # Send one or more requests depending on the number of results, the # page size and the value of fetch_all contacts = [] total_hits = nil fetched_hits = 0 offset = [:offset] begin response = Request.search_contact() total_hits = response['totalHits'] fetched_hits += response['contacts'].size contacts << response['contacts'].map do |result| self.new(result) end #Calculate the next offset. offset += [:page_size] [:offset] = offset end while fetch_all && (total_hits > offset) # Return the hits info and the list of contacts [total_hits, fetched_hits, contacts.flatten] end |