Class: Crunchbase::Model::BatchSearch
- Includes:
- Enumerable
- Defined in:
- lib/crunchbase/model/batch_search.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
(also: #items)
readonly
Returns the value of attribute results.
Attributes inherited from Entity
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ BatchSearch
constructor
A new instance of BatchSearch.
- #populate_results(json) ⇒ Object
Methods inherited from Entity
#convert_date!, #date_keys, #fetch, #instance_multi_relationship_objects, #instance_relationships_object, #instance_timestamps, #one_to_many, #one_to_one, #parse_hash_items, #property_keys, #relationship_lists, #set_relationships_object, #set_variables, #setup_relationships_data!, #special_relationship, #verify_item?
Methods included from Request::Client
#api, #array_from_list, #funding_rounds_lists, #get, #list, #organization_lists, #parsing_from_list, #person_lists, #total_items_from_list
Constructor Details
#initialize(json) ⇒ BatchSearch
Returns a new instance of BatchSearch.
12 13 14 15 16 |
# File 'lib/crunchbase/model/batch_search.rb', line 12 def initialize(json) @results = [] populate_results(json) end |
Instance Attribute Details
#results ⇒ Object (readonly) Also known as: items
Returns the value of attribute results.
8 9 10 |
# File 'lib/crunchbase/model/batch_search.rb', line 8 def results @results end |
Class Method Details
.batch_search(requests) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'lib/crunchbase/model/batch_search.rb', line 29 def self.batch_search(requests) raise ConfigurationException, 'Invalid argument. Please pass in an array as an argument' unless requests.is_a?(Array) raise InvalidRequestException, "Too many requests(#{requests.length}) in batch, max allowed 10" if requests.length > 10 raise MissingParamsException, 'Missing :type or :uuid parameter in some requests' if requests.any? { |request| !request.key?(:type) || !request.key?(:uuid) } return [] if requests.empty? BatchSearch.new API.batch_search(requests) end |