class EbayClient::Request

Public Class Methods

new(api, name, body) click to toggle source
# File lib/ebay_client/request.rb, line 2
def initialize(api, name, body)
  @api = api
  @name = name
  @body = body || {}
end

Public Instance Methods

execute() click to toggle source
# File lib/ebay_client/request.rb, line 20
def execute
  read_response execute_request.body
end
name_symbol() click to toggle source
# File lib/ebay_client/request.rb, line 12
def name_symbol
  @name_sym ||= @name.to_s.gsub(/_ebay_/i, 'e_bay_').to_sym
end
normalized_body() click to toggle source
# File lib/ebay_client/request.rb, line 16
def normalized_body
  @normalized_body ||= @body.to_hash.merge body_defaults
end
normalized_name() click to toggle source
# File lib/ebay_client/request.rb, line 8
def normalized_name
  @normalized_name ||= @name.to_s.camelcase.gsub(/ebay/i, 'eBay')
end

Protected Instance Methods

body_defaults() click to toggle source
# File lib/ebay_client/request.rb, line 25
def body_defaults
  {
    :Version => @api.configuration.version,
    :WarningLevel => @api.configuration.warning_level,
    :ErrorLanguage => @api.configuration.error_language
  }
end
execute_request() click to toggle source
# File lib/ebay_client/request.rb, line 33
def execute_request
  @api.client.set_endpoint @api.endpoint.url_for normalized_name
  @api.client.call(name_symbol, soap_header:  @api.header.to_hash, message: normalized_body)
end
read_response(response_body) click to toggle source
# File lib/ebay_client/request.rb, line 38
def read_response(response_body)
  EbayClient::Response.new response_body.values.first
end