Class: Ebay::Finding::Api::Client
- Inherits:
-
Object
- Object
- Ebay::Finding::Api::Client
- Defined in:
- lib/ebay/finding/api/client.rb
Instance Method Summary collapse
- #find_items_by_keywords(keyword) ⇒ Object
- #find_items_by_product(type, product_id) ⇒ Object
-
#initialize(app_id, sandbox = true) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(app_id, sandbox = true) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 |
# File 'lib/ebay/finding/api/client.rb', line 8 def initialize(app_id, sandbox = true) @app_id = app_id @sandbox = sandbox @base_options = { "SECURITY-APPNAME" => @app_id, "SERVICE-VERSION" => SERVICE_VERSION, "REST-PAYLOAD" => "TRUE", "RESPONSE-DATA-FORMAT" => "JSON" } end |
Instance Method Details
#find_items_by_keywords(keyword) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/ebay/finding/api/client.rb', line 15 def find_items_by_keywords(keyword) operation_name = "findItemsByKeywords" = @base_options.merge("OPERATION-NAME" => operation_name, "keywords" => keyword) Response.new(operation_name, connection.get("/services/search/FindingService/v1", )) end |
#find_items_by_product(type, product_id) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ebay/finding/api/client.rb', line 22 def find_items_by_product(type, product_id) operation_name = "findItemsByProduct" unless PRODUCT_TYPES.include? type raise ArgumentError.new("You need to pass string 'ISBN', 'UPC', 'EAN' or 'ReferenceID' to first argument") end = @base_options.merge("OPERATION-NAME" => operation_name, "productId.@type" => type, "productId" => product_id) Response.new(operation_name, connection.get("/services/search/FindingService/v1", )) end |