Class: EbayTrader::SessionID
- Defined in:
- lib/ebay_trader/session_id.rb
Overview
Request a session ID from the eBay API.
Constant Summary collapse
- CALL_NAME =
'GetSessionID'
Constants inherited from Request
Instance Attribute Summary collapse
-
#ru_name ⇒ String
readonly
The application RuName defined in Configuration#ru_name, unless over-ridden in #initialize args.
Attributes inherited from Request
#auth_token, #call_name, #ebay_site_id, #http_response_code, #http_timeout, #known_arrays, #message_id, #response_hash, #response_time, #skip_type_casting, #xml_request, #xml_response, #xml_tab_width
Instance Method Summary collapse
-
#id ⇒ String
Get the session ID returned by the API call.
-
#initialize(args = {}) ⇒ SessionID
constructor
Construct a GetSessionID eBay API call.
-
#sign_in_url(ruparams = {}) ⇒ String
Get the URL through which a user must sign in using this session ID.
Methods inherited from Request
#deep_find, #errors, #errors_and_warnings, #failure?, #has_errors?, #has_errors_or_warnings?, #has_warnings?, #partial_failure?, #success?, #timestamp, #to_json_s, #to_s, #warnings
Constructor Details
#initialize(args = {}) ⇒ SessionID
Construct a GetSessionID eBay API call.
29 30 31 32 33 34 35 |
# File 'lib/ebay_trader/session_id.rb', line 29 def initialize(args = {}) @ru_name = (args[:ru_name] || EbayTrader.configuration.ru_name).freeze super(CALL_NAME, args) do RuName ru_name end end |
Instance Attribute Details
#ru_name ⇒ String (readonly)
The application RuName defined in Configuration#ru_name, unless over-ridden in #initialize args.
22 23 24 |
# File 'lib/ebay_trader/session_id.rb', line 22 def ru_name @ru_name end |
Instance Method Details
#id ⇒ String
Get the session ID returned by the API call.
40 41 42 |
# File 'lib/ebay_trader/session_id.rb', line 40 def id response_hash[:session_id] end |
#sign_in_url(ruparams = {}) ⇒ String
Get the URL through which a user must sign in using this session ID.
49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ebay_trader/session_id.rb', line 49 def sign_in_url(ruparams = {}) url = [] url << EbayTrader.configuration.production? ? 'https://signin.ebay.com' : 'https://signin.sandbox.ebay.com' url << '/ws/eBayISAPI.dll?SignIn' url << "&runame=#{url_encode ru_name}" url << "&SessID=#{url_encode id}" if ruparams && ruparams.is_a?(Hash) && !ruparams.empty? params = [] ruparams.each_pair { |key, value| params << "#{key}=#{value}" } url << "&ruparams=#{url_encode(params.join('&'))}" end url.join end |