Class: Bing::Content::Api::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/bing/content/api/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_entries, batch) ⇒ Response

Returns a new instance of Response.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bing/content/api/response.rb', line 7

def initialize(response_entries, batch)
  @failures = []
  @successes = []

  response_entries.each do |entry|
    id = entry["batchId"].to_i
    error = entry["errors"]
    if error
      failures << { response: entry, product: batch.product_by_batch_id(id) }
    else
      successes << { response: entry, product: batch.product_by_batch_id(id) }
    end
  end
end

Instance Attribute Details

#failuresObject (readonly)

Returns the value of attribute failures.



5
6
7
# File 'lib/bing/content/api/response.rb', line 5

def failures
  @failures
end

#successesObject (readonly)

Returns the value of attribute successes.



5
6
7
# File 'lib/bing/content/api/response.rb', line 5

def successes
  @successes
end