Class: Bing::Content::Api::BatchProcessor
- Inherits:
-
Object
- Object
- Bing::Content::Api::BatchProcessor
- Defined in:
- lib/bing/content/api/batch_processor.rb
Instance Method Summary collapse
- #execute(batch) ⇒ Object
-
#initialize(connector) ⇒ BatchProcessor
constructor
A new instance of BatchProcessor.
Constructor Details
#initialize(connector) ⇒ BatchProcessor
Returns a new instance of BatchProcessor.
5 6 7 |
# File 'lib/bing/content/api/batch_processor.rb', line 5 def initialize(connector) @connector = connector end |
Instance Method Details
#execute(batch) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/bing/content/api/batch_processor.rb', line 9 def execute(batch) post_body = batch.to_body http_response = @connector.post('/products/batch', post_body) raise http_response.body if http_response.error? body = JSON.parse(http_response.body) entries = body["entries"] Bing::Content::Api::Response.new(entries, batch) end |