Sha256: 66bbbee7a16dd28c9a2c61279416d96de9f4ea20a043482e054e33e1b75da4f7

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 Bytes

Contents

module Rapa
  module Responses
    class ListItemsResponse < MultipleResourcesResponse
      # @return [Rapa::Error]
      def error
        if value = body.dig("ItemLookupErrorResponse", "Error")
          ::Rapa::Error.new(value)
        end
      end

      # @return [Boolean]
      def has_error?
        !error.nil?
      end

      # @return [Boolean]
      def has_valid_request?
        body.dig("ItemLookupResponse", "Items", "Request", "IsValid") == "True"
      end

      private

      # @note Override
      def resource_class
        ::Rapa::Resources::ItemResource
      end

      # @note Override
      def source_or_sources
        body.dig("ItemLookupResponse", "Items", "Item")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rapa-0.6.0 lib/rapa/responses/multiple_resources_response/list_items_response.rb