Sha256: 6aff9a8c67d6480fadafde52b91b75a2bff888d991d6afe6fb56ff03b3888143

Contents?: true

Size: 460 Bytes

Versions: 1

Compression:

Stored size: 460 Bytes

Contents

module Ebay::Finding::Api
  class Response
    attr_reader :response

    def initialize(key_name, response)
      @key_name = key_name
      @response = response
    end

    def items
      return [] unless success?

      result = JSON.parse(@response.body)["#{@key_name}Response"].first["searchResult"].first

      return [] if result["@count"] === "0"

      @items ||= result["item"]
    end

    def success?
      @response.success?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ebay-finding-api-0.1.1 lib/ebay/finding/api/response.rb