Class: EbayTrader::FetchToken

Inherits:
Request
  • Object
show all
Defined in:
lib/ebay_trader/fetch_token.rb

Overview

Fetch an eBay user authentication token using a SessionID value.

Constant Summary collapse

CALL_NAME =
'FetchToken'

Constants inherited from Request

Request::XMLNS

Instance Attribute Summary collapse

Attributes inherited from Request

#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

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(session_id, args = {}) ⇒ FetchToken

Construct a fetch token eBay API request with the given session ID.

Parameters:

  • session_id (SessionID|String)

    the session ID.

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

    a hash of optional arguments.



25
26
27
28
29
30
31
# File 'lib/ebay_trader/fetch_token.rb', line 25

def initialize(session_id, args = {})
  session_id = session_id.id if session_id.is_a?(SessionID)
  @session_id = session_id.freeze
  super(CALL_NAME, args) do
    SessionID session_id
  end
end

Instance Attribute Details

#session_idObject (readonly)

Returns the value of attribute session_id.



19
20
21
# File 'lib/ebay_trader/fetch_token.rb', line 19

def session_id
  @session_id
end

Instance Method Details

#auth_tokenString

Get the authentication token.

Returns:

  • (String)

    the authentication token.



36
37
38
# File 'lib/ebay_trader/fetch_token.rb', line 36

def auth_token
  response_hash[:ebay_auth_token]
end

#expiry_timeTime

Get the Time at which the authentication token expires.

Returns:

  • (Time)

    the expiry time.



43
44
45
# File 'lib/ebay_trader/fetch_token.rb', line 43

def expiry_time
  response_hash[:hard_expiration_time]
end