Sha256: 18e2e523af15456ba9f2ad2a7fa01623e5f23a8a487d317b22fc1acec8965329
Contents?: true
Size: 979 Bytes
Versions: 3
Compression:
Stored size: 979 Bytes
Contents
module A2z module Responses class ItemLookup attr_accessor :operation_request, :item, :valid def initialize @valid = true end def valid? @valid end def valid=(value) @valid = !!value end # TODO capture item_search_response['Items']['Request']['Errors'] into an attr_accessor value # TODO consider capturing item_search_response['Items']['Request'] into an attr_accessor value def self.from_response(data) new.tap do |item_lookup| item_lookup.operation_request = OperationRequest.from_response(data['OperationRequest']) if data['OperationRequest'] item_lookup.item = Item.from_response(data['Items']['Item']) if data['Items'] && data['Items']['Item'] item_lookup.valid = data['Items']['Request']['IsValid'] == 'True' rescue false item_lookup.freeze end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
a2z-0.0.3 | lib/a2z/responses/item_lookup.rb |
a2z-0.0.2 | lib/a2z/responses/item_lookup.rb |
a2z-0.0.1 | lib/a2z/responses/item_lookup.rb |