lib/ebay/merchandising.rb in ebay-ruby-0.3.0 vs lib/ebay/merchandising.rb in ebay-ruby-0.3.1
- old
+ new
@@ -1,23 +1,20 @@
# frozen_string_literal: true
-require 'http'
-
require 'ebay/config'
-require 'ebay/sandboxable'
+require 'ebay/requestable'
module Ebay
# Retrieves information about products or item listings on eBay to help you
# sell more merchandise to eBay buyers
#
# @see https://developer.ebay.com/Devzone/merchandising/docs/Concepts/MerchandisingAPI_FormatOverview.html
# @see https://developer.ebay.com/Devzone/merchandising/docs/CallRef/index.html
class Merchandising
- include Sandboxable
+ include Requestable
- SANDBOX_ENDPOINT = 'https://svcs.sandbox.ebay.com/MerchandisingService'
- PRODUCTION_ENDPOINT = 'https://svcs.ebay.com/MerchandisingService'
+ self.endpoint = 'https://svcs.ebay.com/MerchandisingService'
# @return [String]
attr_reader :consumer_id
# @return [String, nil]
@@ -78,17 +75,16 @@
end
private
def request(operation, payload = {})
- endpoint = sandbox? ? SANDBOX_ENDPOINT : PRODUCTION_ENDPOINT
params = { 'CONSUMER-ID' => consumer_id,
'GLOBAL-ID' => global_id,
'OPERATION-NAME' => operation,
'REQUEST-DATA-FORMAT' => 'JSON',
'RESPONSE-DATA-FORMAT' => response_data_format,
'SERVICE-VERSION' => service_version }.compact
- HTTP.post(endpoint, params: params, body: JSON.dump(payload))
+ http.post(endpoint, params: params, body: JSON.dump(payload))
end
end
end