Class: Puzzle::Company

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_contactsObject

Returns the value of attribute active_contacts.



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

def active_contacts
  @active_contacts
end

#addressObject

Returns the value of attribute address.



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

def address
  @address
end

#cityObject

Returns the value of attribute city.



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

def city
  @city
end

#countryObject

Returns the value of attribute country.



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

def country
  @country
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#zipObject

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(options)
  companies = []
  results = {}
  result = Puzzle::Request.get("/searchCompany", options)
  result["companies"].each do |company|
    companies << new(company)
  end
  results = {
    :total => result["totalHits"],
    :companies => companies
  }
end