Class: Jigsaw::Request
- Inherits:
-
Object
- Object
- Jigsaw::Request
- 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
-
#response ⇒ Object
Returns the value of attribute response.
Class Method Summary collapse
- .company(id, options = {}) ⇒ Object
- .search_company(options = {}) ⇒ Object
- .search_contact(options = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(url, options) ⇒ Request
constructor
A new instance of Request.
- #parsed_response ⇒ Object
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, ) @response = self.class.get(url, :query => ) end |
Instance Attribute Details
#response ⇒ Object
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, = {}) request = new(COMPANY_URL + id + ".json", ) request.parsed_response end |
.search_company(options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/jigsaw/request.rb', line 16 def self.search_company( = {}) request = new(SEARCH_COMPANY_URL, ) request.parsed_response end |
.search_contact(options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/jigsaw/request.rb', line 21 def self.search_contact( = {}) request = new(SEARCH_CONTACT_URL, ) request.parsed_response end |
Instance Method Details
#parsed_response ⇒ Object
35 36 37 |
# File 'lib/jigsaw/request.rb', line 35 def parsed_response @response.parsed_response end |