Class: Ebay::Shopping
- Inherits:
-
Object
- Object
- Ebay::Shopping
- Includes:
- Sandboxable
- Defined in:
- lib/ebay/shopping.rb
Overview
The eBay Shopping API makes it easy to search for things on eBay.
Constant Summary collapse
- SANDBOX_ENDPOINT =
'https://open.api.sandbox.ebay.com/shopping'- PRODUCTION_ENDPOINT =
'https://open.api.ebay.com/shopping'
Instance Attribute Summary collapse
- #affiliate_user_id ⇒ String? readonly
- #app_id ⇒ String readonly
- #response_encoding ⇒ String? readonly
- #site_id ⇒ String? readonly
- #tracking_id ⇒ String? readonly
- #tracking_partner_code ⇒ String? readonly
- #version ⇒ String readonly
- #version_handling ⇒ String? readonly
Attributes included from Sandboxable
Instance Method Summary collapse
-
#find_products(payload = {}) ⇒ HTTP::Response
Returns one or more eBay catalog products based on a query string or product ID value.
-
#get_category_info(category_id, payload = {}) ⇒ HTTP::Response
Retrieves high-level data for a specified eBay category.
-
#get_ebay_time(payload = {}) ⇒ HTTP::Response
Gets the official eBay system time in GMT.
-
#get_item_status(*item_ids, payload = {}) ⇒ HTTP::Response
Retrieves the current status of up to 20 eBay listings.
-
#get_multiple_items(*item_ids, payload = {}) ⇒ HTTP::Response
Retrieves publicly available data for one or more listings.
-
#get_shipping_costs(item_id, payload = {}) ⇒ HTTP::Response
Gets shipping costs for a listing.
-
#get_single_item(item_id, payload = {}) ⇒ HTTP::Response
Gets publicly visible details about one listing.
-
#get_user_profile(user_id, payload = {}) ⇒ HTTP::Response
Retrieves user information.
-
#initialize(app_id: Config.app_id, response_encoding: 'JSON', site_id: nil, version: '1119', version_handling: nil, tracking_id: nil, tracking_partner_code: nil, affiliate_user_id: nil) ⇒ Shopping
constructor
Returns a Finding API request instance.
Methods included from Sandboxable
Constructor Details
#initialize(app_id: Config.app_id, response_encoding: 'JSON', site_id: nil, version: '1119', version_handling: nil, tracking_id: nil, tracking_partner_code: nil, affiliate_user_id: nil) ⇒ Shopping
Returns a Finding API request instance
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ebay/shopping.rb', line 53 def initialize(app_id: Config.app_id, response_encoding: 'JSON', site_id: nil, version: '1119', version_handling: nil, tracking_id: nil, tracking_partner_code: nil, affiliate_user_id: nil) @app_id = app_id @response_encoding = response_encoding @site_id = site_id @version = version @version_handling = version_handling @tracking_id = tracking_id @tracking_partner_code = tracking_partner_code @affiliate_user_id = affiliate_user_id end |
Instance Attribute Details
#affiliate_user_id ⇒ String? (readonly)
41 42 43 |
# File 'lib/ebay/shopping.rb', line 41 def affiliate_user_id @affiliate_user_id end |
#app_id ⇒ String (readonly)
20 21 22 |
# File 'lib/ebay/shopping.rb', line 20 def app_id @app_id end |
#response_encoding ⇒ String? (readonly)
23 24 25 |
# File 'lib/ebay/shopping.rb', line 23 def response_encoding @response_encoding end |
#site_id ⇒ String? (readonly)
26 27 28 |
# File 'lib/ebay/shopping.rb', line 26 def site_id @site_id end |
#tracking_id ⇒ String? (readonly)
35 36 37 |
# File 'lib/ebay/shopping.rb', line 35 def tracking_id @tracking_id end |
#tracking_partner_code ⇒ String? (readonly)
38 39 40 |
# File 'lib/ebay/shopping.rb', line 38 def tracking_partner_code @tracking_partner_code end |
#version ⇒ String (readonly)
29 30 31 |
# File 'lib/ebay/shopping.rb', line 29 def version @version end |
#version_handling ⇒ String? (readonly)
32 33 34 |
# File 'lib/ebay/shopping.rb', line 32 def version_handling @version_handling end |
Instance Method Details
#find_products(payload = {}) ⇒ HTTP::Response
Returns one or more eBay catalog products based on a query string or product ID value
72 73 74 |
# File 'lib/ebay/shopping.rb', line 72 def find_products(payload = {}) request('FindProducts', payload) end |
#get_category_info(category_id, payload = {}) ⇒ HTTP::Response
Retrieves high-level data for a specified eBay category
81 82 83 84 |
# File 'lib/ebay/shopping.rb', line 81 def get_category_info(category_id, payload = {}) payload.update('CategoryID' => category_id) request('GetCategoryInfo', payload) end |
#get_ebay_time(payload = {}) ⇒ HTTP::Response
Gets the official eBay system time in GMT
90 91 92 |
# File 'lib/ebay/shopping.rb', line 90 def get_ebay_time(payload = {}) request('GeteBayTime', payload) end |
#get_item_status(*item_ids, payload = {}) ⇒ HTTP::Response
Retrieves the current status of up to 20 eBay listings
100 101 102 103 104 |
# File 'lib/ebay/shopping.rb', line 100 def get_item_status(*item_ids) payload = item_ids.last.is_a?(Hash) ? item_ids.pop : {} payload.update('ItemID' => item_ids.join(',')) request('GetItemStatus', payload) end |
#get_multiple_items(*item_ids, payload = {}) ⇒ HTTP::Response
Retrieves publicly available data for one or more listings
112 113 114 115 116 117 |
# File 'lib/ebay/shopping.rb', line 112 def get_multiple_items(*item_ids) payload = item_ids.last.is_a?(Hash) ? item_ids.pop : {} payload.update('ItemID' => item_ids.join(',')) request('GetMultipleItems', payload) end |
#get_shipping_costs(item_id, payload = {}) ⇒ HTTP::Response
Gets shipping costs for a listing
124 125 126 127 |
# File 'lib/ebay/shopping.rb', line 124 def get_shipping_costs(item_id, payload = {}) payload.update('ItemID' => item_id) request('GetShippingCosts', payload) end |
#get_single_item(item_id, payload = {}) ⇒ HTTP::Response
Gets publicly visible details about one listing
134 135 136 137 |
# File 'lib/ebay/shopping.rb', line 134 def get_single_item(item_id, payload = {}) payload.update('ItemID' => item_id) request('GetSingleItem', payload) end |
#get_user_profile(user_id, payload = {}) ⇒ HTTP::Response
Retrieves user information
144 145 146 147 |
# File 'lib/ebay/shopping.rb', line 144 def get_user_profile(user_id, payload = {}) payload.update('UserID' => user_id) request('GetUserProfile', payload) end |