Sha256: 692a762386ee2b62d4d9c400b7283f974ca52303c45c0a8b1b5a09633b472c2c

Contents?: true

Size: 837 Bytes

Versions: 1

Compression:

Stored size: 837 Bytes

Contents

module Ebay::Finding::Api
  PRODUCTION_ENDPOINT = "https://svcs.ebay.com"
  SANDBOX_ENDPOINT    = "https://svcs.sandbox.ebay.com"
  SERVICE_VERSION     = "1.13.0"

  class Client
    def initialize(app_id, sandbox = true)
      @app_id  = app_id
      @sandbox = sandbox
    end

    def find_items_by_keywords(keyword)
      operation_name = "findItemsByKeywords"
      options = { "OPERATION-NAME" => operation_name, "SERVICE-VERSION" => SERVICE_VERSION, "REST-PAYLOAD" => "TRUE",
                  "SECURITY-APPNAME" => @app_id, "RESPONSE-DATA-FORMAT" => "JSON", "keywords" => keyword }

      Response.new(operation_name, connection.get("/ervices/search/FindingService/v1", options))
    end

    private

    def connection
      @connection ||= Faraday.new(url: @sandbox ? SANDBOX_ENDPOINT : PRODUCTION_ENDPOINT)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ebay-finding-api-0.1.0 lib/ebay/finding/api/client.rb