module Crunchbase::Request::Client
Public Instance Methods
api()
click to toggle source
# File lib/crunchbase/request/client.rb, line 63 def api Crunchbase::API end
array_from_list(list)
click to toggle source
# File lib/crunchbase/request/client.rb, line 37 def array_from_list(list) return [] if list.nil? list['items'].map do |l| new l if l.is_a?(Hash) end.compact end
funding_rounds_lists(permalink, options = {})
click to toggle source
# File lib/crunchbase/request/client.rb, line 31 def funding_rounds_lists(permalink, options = {}) options = options.merge(model_name: self) api.funding_rounds_lists(permalink, self::RESOURCE_LIST.tr('_', '-'), options) end
get(permalink)
click to toggle source
Factory method to return an instance from a permalink
# File lib/crunchbase/request/client.rb, line 7 def get(permalink) result = api.single_entity(permalink, self::RESOURCE_NAME) new(result) end
kclass_name(resource_list)
click to toggle source
# File lib/crunchbase/request/client.rb, line 59 def kclass_name(resource_list) api::SUPPORTED_ENTITIES[resource_list] || nil end
list(page = nil)
click to toggle source
# File lib/crunchbase/request/client.rb, line 13 def list(page = nil) model_name = kclass_name(self::RESOURCE_LIST) api.list({ page: page, model_name: model_name }, self::RESOURCE_LIST) end
organization_lists(permalink, options = {})
click to toggle source
# File lib/crunchbase/request/client.rb, line 19 def organization_lists(permalink, options = {}) options = options.merge(model_name: self) api.organization_lists(permalink, self::RESOURCE_LIST, options) end
parsing_from_list(list)
click to toggle source
# File lib/crunchbase/request/client.rb, line 45 def parsing_from_list(list) return [] if list.nil? list.map do |l| new l if l.is_a?(Hash) end.compact end
person_lists(permalink, options = {})
click to toggle source
# File lib/crunchbase/request/client.rb, line 25 def person_lists(permalink, options = {}) options = options.merge(model_name: self) api.person_lists(permalink, self::RESOURCE_LIST, options) end
total_items_from_list(list)
click to toggle source
# File lib/crunchbase/request/client.rb, line 53 def total_items_from_list(list) return 0 if list.nil? list['paging']['total_items'] end