Class: Ebay::Finding

Inherits:
Object
  • Object
show all
Includes:
Requestable
Defined in:
lib/ebay/finding.rb

Overview

The Finding API lets you search and browse for items listed on eBay and provides useful metadata to refine searches.

Instance Attribute Summary collapse

Attributes included from Requestable

#endpoint, #headers, #http

Instance Method Summary collapse

Methods included from Requestable

#market_id=, #persistent, #sandbox, #use, #via

Constructor Details

#initialize(global_id: nil, message_encoding: nil, response_data_format: nil, security_appname: Config.app_id, service_version: nil) ⇒ Finding

Returns a Finding API request instance

Parameters:

  • global_id (String) (defaults to: nil)
  • message_encoding (String) (defaults to: nil)
  • response_data_format (String) (defaults to: nil)
  • security_appname (String) (defaults to: Config.app_id)
  • service_version (String) (defaults to: nil)

See Also:



46
47
48
49
50
51
52
53
54
# File 'lib/ebay/finding.rb', line 46

def initialize(global_id: nil, message_encoding: nil,
               response_data_format: nil,
               security_appname: Config.app_id, service_version: nil)
  @global_id = global_id
  @message_encoding = message_encoding
  @response_data_format = response_data_format
  @security_appname = security_appname
  @service_version = service_version
end

Instance Attribute Details

#global_idString (readonly)

Returns:

  • (String)


24
25
26
# File 'lib/ebay/finding.rb', line 24

def global_id
  @global_id
end

#message_encodingString (readonly)

Returns:

  • (String)


27
28
29
# File 'lib/ebay/finding.rb', line 27

def message_encoding
  @message_encoding
end

#response_data_formatString (readonly)

Returns:

  • (String)


30
31
32
# File 'lib/ebay/finding.rb', line 30

def response_data_format
  @response_data_format
end

#security_appnameString (readonly)

Returns:

  • (String)


33
34
35
# File 'lib/ebay/finding.rb', line 33

def security_appname
  @security_appname
end

#service_versionString (readonly)

Returns:

  • (String)


36
37
38
# File 'lib/ebay/finding.rb', line 36

def service_version
  @service_version
end

Instance Method Details

#find_completed_items(payload = {}) ⇒ HTTP::Response

Searches for items whose listings are completed

Parameters:

  • payload (Hash) (defaults to: {})

Returns:

  • (HTTP::Response)


60
61
62
# File 'lib/ebay/finding.rb', line 60

def find_completed_items(payload = {})
  request('findCompletedItems', payload)
end

#find_items_advanced(payload = {}) ⇒ HTTP::Response

Searches for items by category or keyword or both

Parameters:

  • payload (Hash) (defaults to: {})

Returns:

  • (HTTP::Response)


68
69
70
# File 'lib/ebay/finding.rb', line 68

def find_items_advanced(payload = {})
  request('findItemsAdvanced', payload)
end

#find_items_by_category(payload = {}) ⇒ HTTP::Response

Searches for items using specific eBay category ID numbers

Parameters:

  • payload (Hash) (defaults to: {})

Returns:

  • (HTTP::Response)


76
77
78
# File 'lib/ebay/finding.rb', line 76

def find_items_by_category(payload = {})
  request('findItemsByCategory', payload)
end

#find_items_by_keywords(keywords, payload = {}) ⇒ HTTP::Response

Searches for items by a keyword query

Parameters:

  • keywords (String)
  • payload (Hash) (defaults to: {})

Returns:

  • (HTTP::Response)


85
86
87
88
# File 'lib/ebay/finding.rb', line 85

def find_items_by_keywords(keywords, payload = {})
  payload = payload.merge('keywords' => keywords)
  request('findItemsByKeywords', payload)
end

#find_items_by_product(product_id, product_id_type, payload = {}) ⇒ HTTP::Response

Searches for items using specific eBay product values\

Parameters:

  • product_id (String)
  • product_id_type (String)
  • payload (Hash) (defaults to: {})

Returns:

  • (HTTP::Response)


96
97
98
99
100
101
# File 'lib/ebay/finding.rb', line 96

def find_items_by_product(product_id, product_id_type, payload = {})
  payload = payload.merge('productId' => product_id,
                          'productId.@type' => product_id_type)

  request('findItemsByProduct', payload)
end

#find_items_in_ebay_stores(payload = {}) ⇒ HTTP::Response

Searches for items in the eBay store inventories

Parameters:

  • payload (Hash) (defaults to: {})

Returns:

  • (HTTP::Response)


107
108
109
# File 'lib/ebay/finding.rb', line 107

def find_items_in_ebay_stores(payload = {})
  request('findItemsIneBayStores', payload)
end

#get_histograms(category_id) ⇒ HTTP::Response

Retrieves category and/or aspect histogram information for an eBay category

Parameters:

  • category_id (String)

Returns:

  • (HTTP::Response)


116
117
118
# File 'lib/ebay/finding.rb', line 116

def get_histograms(category_id)
  request('getHistograms', 'categoryId' => category_id)
end

#get_search_keywords_recommendation(keywords) ⇒ HTTP::Response

Retrieves commonly used words found in eBay titles, based on the words you supply

Parameters:

  • keywords (String)

Returns:

  • (HTTP::Response)


125
126
127
# File 'lib/ebay/finding.rb', line 125

def get_search_keywords_recommendation(keywords)
  request('getSearchKeywordsRecommendation', 'keywords' => keywords)
end

#get_versionHTTP::Response

Returns the current version of the service

Returns:

  • (HTTP::Response)


132
133
134
# File 'lib/ebay/finding.rb', line 132

def get_version
  request('getVersion')
end