Class: Ebay::Browse
Overview
The Browse API allows your buyers to search eBay items by keyword and category. It also allows them to view and add items to their eBay shopping cart.
Instance Attribute Summary collapse
Attributes included from Requestable
#endpoint, #headers, #http
Instance Method Summary
collapse
-
#add_item ⇒ Object
-
#check_compatibility(item_id, marketplace_id, compatibility_properties) ⇒ HTTP::Response
Retrieves the details of the individual items in an item group.
-
#get_item(item_id, params = {}) ⇒ HTTP::Response
Retrieves the details of a specific item.
-
#get_item_by_legacy_id(legacy_item_id, params = {}) ⇒ HTTP::Response
Retrieves the details of a specific item using its legacy item ID.
-
#get_items_by_item_group(item_group_id) ⇒ HTTP::Response
Retrieves the details of the individual items in an item group.
-
#get_shopping_cart ⇒ Object
-
#initialize(access_token:, campaign_id:, reference_id: nil, country: nil, zip: nil, market_id: 'EBAY_US') ⇒ Browse
constructor
Returns a Browse API request instance.
-
#remove_item ⇒ Object
-
#search(params = {}) ⇒ HTTP::Response
Searches for eBay items by various query parameters and retrieves summaries of the item.
-
#search_by_image(image, params = {}) ⇒ HTTP::Response
Searches for eBay items based on a image and retrieves their summaries.
-
#update_quantity ⇒ Object
#market_id=, #persistent, #sandbox, #use, #via
Constructor Details
#initialize(access_token:, campaign_id:, reference_id: nil, country: nil, zip: nil, market_id: 'EBAY_US') ⇒ Browse
Returns a Browse API request instance
50
51
52
53
54
55
56
57
|
# File 'lib/ebay/browse.rb', line 50
def initialize(access_token:, campaign_id:, reference_id: nil, country: nil, zip: nil, market_id: 'EBAY_US')
@campaign_id = campaign_id
@reference_id = reference_id
@country = country
@zip = zip
@access_token = access_token
@market_id = market_id
end
|
Instance Attribute Details
#access_token ⇒ String
25
26
27
|
# File 'lib/ebay/browse.rb', line 25
def access_token
@access_token
end
|
#campaign_id ⇒ String
28
29
30
|
# File 'lib/ebay/browse.rb', line 28
def campaign_id
@campaign_id
end
|
#country ⇒ String?
34
35
36
|
# File 'lib/ebay/browse.rb', line 34
def country
@country
end
|
#market_id ⇒ String?
40
41
42
|
# File 'lib/ebay/browse.rb', line 40
def market_id
@market_id
end
|
#reference_id ⇒ String?
31
32
33
|
# File 'lib/ebay/browse.rb', line 31
def reference_id
@reference_id
end
|
#zip ⇒ String?
37
38
39
|
# File 'lib/ebay/browse.rb', line 37
def zip
@zip
end
|
Instance Method Details
#add_item ⇒ Object
131
132
133
|
# File 'lib/ebay/browse.rb', line 131
def add_item
raise 'not implemented'
end
|
#check_compatibility(item_id, marketplace_id, compatibility_properties) ⇒ HTTP::Response
Retrieves the details of the individual items in an item group
122
123
124
125
126
127
128
129
|
# File 'lib/ebay/browse.rb', line 122
def check_compatibility(item_id, marketplace_id, compatibility_properties)
url = build_url('item', item_id, 'check_compatibility')
=
.update('X-EBAY-C-MARKETPLACE-ID' => marketplace_id, 'CONTENT-TYPE' => 'application/json')
body = JSON.dump('compatibilityProperties' => compatibility_properties)
http.().post(url, body: body)
end
|
#get_item(item_id, params = {}) ⇒ HTTP::Response
Retrieves the details of a specific item
87
88
89
90
91
92
|
# File 'lib/ebay/browse.rb', line 87
def get_item(item_id, params = {})
url = build_url('item', item_id)
params = params.merge(item_id: item_id)
http.().get(url, params: params)
end
|
#get_item_by_legacy_id(legacy_item_id, params = {}) ⇒ HTTP::Response
Retrieves the details of a specific item using its legacy item ID
99
100
101
102
103
104
|
# File 'lib/ebay/browse.rb', line 99
def get_item_by_legacy_id(legacy_item_id, params = {})
url = build_url('item', 'get_item_by_legacy_id')
params = params.merge(legacy_item_id: legacy_item_id)
http.().get(url, params: params)
end
|
#get_items_by_item_group(item_group_id) ⇒ HTTP::Response
Retrieves the details of the individual items in an item group
110
111
112
113
114
115
|
# File 'lib/ebay/browse.rb', line 110
def get_items_by_item_group(item_group_id)
url = build_url('item', 'get_items_by_item_group')
params = { item_group_id: item_group_id }
http.().get(url, params: params)
end
|
135
136
137
|
# File 'lib/ebay/browse.rb', line 135
def get_shopping_cart
raise 'not implemented'
end
|
#remove_item ⇒ Object
139
140
141
|
# File 'lib/ebay/browse.rb', line 139
def remove_item
raise 'not implemented'
end
|
#search(params = {}) ⇒ HTTP::Response
Searches for eBay items by various query parameters and retrieves summaries of the item
63
64
65
66
|
# File 'lib/ebay/browse.rb', line 63
def search(params = {})
url = build_url('item_summary', 'search')
http.().get(url, params: params)
end
|
#search_by_image(image, params = {}) ⇒ HTTP::Response
Searches for eBay items based on a image and retrieves their summaries
73
74
75
76
77
78
79
80
|
# File 'lib/ebay/browse.rb', line 73
def search_by_image(image, params = {})
url = build_url('item_summary', 'search_by_image')
= .update('CONTENT-TYPE' => 'application/json')
encoded_string = Base64.encode64(image.read)
body = JSON.dump(image: encoded_string)
http.().post(url, params: params, body: body)
end
|
#update_quantity ⇒ Object
143
144
145
|
# File 'lib/ebay/browse.rb', line 143
def update_quantity
raise 'not implemented'
end
|