class Firmapi::Companies
Attributes
list[R]
number_of_pages[R]
page[R]
params[R]
results[R]
size[R]
Public Class Methods
new(options, params)
click to toggle source
# File lib/firmapi/companies.rb, line 6 def initialize(options, params) @results = options["results"] @size = options["size"] @page = options["page"] @number_of_pages = options["number_of_pages"] @list = [] @params = params end
where(params)
click to toggle source
# File lib/firmapi/companies.rb, line 29 def self.where(params) @params = params response = API.new.get '/companies', params if response.status == 200 json = response.body companies = self.new(json["result"]["search"], params) json["result"]["list"].each do |company_info| companies.add_company Company.new(company_info) end companies end end
Public Instance Methods
add_company(company)
click to toggle source
# File lib/firmapi/companies.rb, line 15 def add_company(company) @list << company end
next_page()
click to toggle source
# File lib/firmapi/companies.rb, line 23 def next_page params[:page] = page + 1 Companies.where(params) end
to_a()
click to toggle source
# File lib/firmapi/companies.rb, line 19 def to_a @list end