Class: OnlinePayments::SDK::Domain::SessionData

Inherits:
DataObject
  • Object
show all
Defined in:
lib/onlinepayments/sdk/domain/session_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from DataObject

new_from_hash

Instance Attribute Details

#hosted_fields_session_idString

Returns the current value of hosted_fields_session_id.

Returns:

  • (String)

    the current value of hosted_fields_session_id



14
15
16
# File 'lib/onlinepayments/sdk/domain/session_data.rb', line 14

def hosted_fields_session_id
  @hosted_fields_session_id
end

#localeString

Returns the current value of locale.

Returns:

  • (String)

    the current value of locale



14
15
16
# File 'lib/onlinepayments/sdk/domain/session_data.rb', line 14

def locale
  @locale
end

#platform_urlString

Returns the current value of platform_url.

Returns:

  • (String)

    the current value of platform_url



14
15
16
# File 'lib/onlinepayments/sdk/domain/session_data.rb', line 14

def platform_url
  @platform_url
end

#session_tokenString

Returns the current value of session_token.

Returns:

  • (String)

    the current value of session_token



14
15
16
# File 'lib/onlinepayments/sdk/domain/session_data.rb', line 14

def session_token
  @session_token
end

#tokensArray<String>

Returns the current value of tokens.

Returns:

  • (Array<String>)

    the current value of tokens



14
15
16
# File 'lib/onlinepayments/sdk/domain/session_data.rb', line 14

def tokens
  @tokens
end

Instance Method Details

#from_hash(hash) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/onlinepayments/sdk/domain/session_data.rb', line 37

def from_hash(hash)
  super
  if hash.has_key? 'hostedFieldsSessionId'
    @hosted_fields_session_id = hash['hostedFieldsSessionId']
  end
  if hash.has_key? 'locale'
    @locale = hash['locale']
  end
  if hash.has_key? 'platformUrl'
    @platform_url = hash['platformUrl']
  end
  if hash.has_key? 'sessionToken'
    @session_token = hash['sessionToken']
  end
  if hash.has_key? 'tokens'
    raise TypeError, "value '%s' is not an Array" % [hash['tokens']] unless hash['tokens'].is_a? Array
    @tokens = []
    hash['tokens'].each do |e|
      @tokens << e
    end
  end
end

#to_hHash

Returns:

  • (Hash)


27
28
29
30
31
32
33
34
35
# File 'lib/onlinepayments/sdk/domain/session_data.rb', line 27

def to_h
  hash = super
  hash['hostedFieldsSessionId'] = @hosted_fields_session_id unless @hosted_fields_session_id.nil?
  hash['locale'] = @locale unless @locale.nil?
  hash['platformUrl'] = @platform_url unless @platform_url.nil?
  hash['sessionToken'] = @session_token unless @session_token.nil?
  hash['tokens'] = @tokens unless @tokens.nil?
  hash
end