Class: Puzzle::Company
- Inherits:
-
Object
- Object
- Puzzle::Company
- Defined in:
- lib/puzzle/company.rb
Instance Attribute Summary collapse
-
#active_contacts ⇒ Object
Returns the value of attribute active_contacts.
-
#address ⇒ Object
Returns the value of attribute address.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#state ⇒ Object
Returns the value of attribute state.
-
#zip ⇒ Object
Returns the value of attribute zip.
Class Method Summary collapse
-
.find(options) ⇒ Object
Return a list of companies => pageSize: The attribute specifies the maximum number of records to be returned in a request.
Instance Method Summary collapse
-
#initialize(company_info) ⇒ Company
constructor
A new instance of Company.
Constructor Details
#initialize(company_info) ⇒ Company
Returns a new instance of Company.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/puzzle/company.rb', line 5 def initialize(company_info) @id = company_info["companyId"] @name = company_info["name"] @address = company_info["address"] @city = company_info["city"] @state = company_info["state"] @zip = company_info["zip"] @country = company_info["country"] @active_contacts = company_info["activeContacts"] end |
Instance Attribute Details
#active_contacts ⇒ Object
Returns the value of attribute active_contacts.
3 4 5 |
# File 'lib/puzzle/company.rb', line 3 def active_contacts @active_contacts end |
#address ⇒ Object
Returns the value of attribute address.
3 4 5 |
# File 'lib/puzzle/company.rb', line 3 def address @address end |
#city ⇒ Object
Returns the value of attribute city.
3 4 5 |
# File 'lib/puzzle/company.rb', line 3 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
3 4 5 |
# File 'lib/puzzle/company.rb', line 3 def country @country end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'lib/puzzle/company.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/puzzle/company.rb', line 3 def name @name end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/puzzle/company.rb', line 3 def state @state end |
#zip ⇒ Object
Returns the value of attribute zip.
3 4 5 |
# File 'lib/puzzle/company.rb', line 3 def zip @zip end |
Class Method Details
.find(options) ⇒ Object
Return a list of companies
> pageSize: The attribute specifies the maximum number of records to be returned in a request. The default value is 50 and the system limit is 100.
> name: Name of the desired company (indexed to include Company Name, URL, and ticker symbol)
> View developer.jigsaw.com/documentation/search_and_get_api_guide/6_Data_Keys_and_Values for available search parameter
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/puzzle/company.rb', line 20 def self.find() companies = [] results = {} result = Puzzle::Request.get("/searchCompany", ) result["companies"].each do |company| companies << new(company) end results = { :total => result["totalHits"], :companies => companies } end |