class Coyodlee::SessionAuthorization

SessionAuthorization stores cobrand and user session tokens. Its purpose is to make it easy to recreate the Authentication header that must be included in authenticated requests to the Yodlee API

Attributes

cobrand_session_token[RW]

@return [SessionToken] the cobrand session token

user_session_token[RW]

@return [SessionToken] the user session token

Public Class Methods

create(authorization=NullSessionAuthorization.new) click to toggle source
# File lib/coyodlee/session_authorization.rb, line 14
def create(authorization=NullSessionAuthorization.new)
  new(cobrand_session_token: authorization.cobrand_session_token,
      user_session_token: authorization.user_session_token)
end
new(cobrand_session_token: NullSessionToken.new, user_session_token: NullSessionToken.new) click to toggle source
# File lib/coyodlee/session_authorization.rb, line 20
def initialize(cobrand_session_token: NullSessionToken.new, user_session_token: NullSessionToken.new)
  @cobrand_session_token = cobrand_session_token
  @user_session_token = user_session_token
end

Public Instance Methods

to_s() click to toggle source

@return [String] Returns the cobrand (and user) session as a string to be used in the Authentication header

# File lib/coyodlee/session_authorization.rb, line 26
def to_s
  ['cobSession', 'userSession']
    .zip([@cobrand_session_token, @user_session_token])
    .select { |_, token| token.present? }
    .map { |k, token| [k, token.to_s] }
    .map { |arr| arr.join('=') }
    .join(',')
end