lib/a2z/responses/item_lookup.rb in a2z-0.0.3 vs lib/a2z/responses/item_lookup.rb in a2z-0.0.4

- old
+ new

@@ -1,23 +1,23 @@ module A2z module Responses class ItemLookup - attr_accessor :operation_request, :item, :valid + attr_accessor :operation_request, :item 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 valid? + @valid + end + + # TODO capture data['Items']['Request']['Errors'] into an attr_accessor value + # TODO consider capturing data['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