Class: Jigsaw::Request

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/jigsaw/request.rb

Constant Summary collapse

SEARCH_COMPANY_URL =
'https://www.jigsaw.com/rest/searchCompany.json'
SEARCH_CONTACT_URL =
'https://www.jigsaw.com/rest/searchContact.json'
COMPANY_URL =
'https://www.jigsaw.com/rest/companies/'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, options) ⇒ Request

Returns a new instance of Request.



31
32
33
# File 'lib/jigsaw/request.rb', line 31

def initialize(url, options)
  @response = self.class.get(url, :query => options)
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



7
8
9
# File 'lib/jigsaw/request.rb', line 7

def response
  @response
end

Class Method Details

.company(id, options = {}) ⇒ Object



26
27
28
29
# File 'lib/jigsaw/request.rb', line 26

def self.company(id, options = {})
  request = new(COMPANY_URL + id + ".json", options)
  request.parsed_response
end

.search_company(options = {}) ⇒ Object



16
17
18
19
# File 'lib/jigsaw/request.rb', line 16

def self.search_company(options = {})
  request = new(SEARCH_COMPANY_URL, options)
  request.parsed_response
end

.search_contact(options = {}) ⇒ Object



21
22
23
24
# File 'lib/jigsaw/request.rb', line 21

def self.search_contact(options = {})
  request = new(SEARCH_CONTACT_URL, options)
  request.parsed_response
end

Instance Method Details

#parsed_responseObject



35
36
37
# File 'lib/jigsaw/request.rb', line 35

def parsed_response
  @response.parsed_response
end