Class: ShellSmartPayApi::MppAccesTokenResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/shell_smart_pay_api/models/mpp_acces_token_response.rb

Overview

MppAccesTokenResponse Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(access_token = SKIP, token_type = 'bearer', expires_in = SKIP, scope = 'basic openid') ⇒ MppAccesTokenResponse

Returns a new instance of MppAccesTokenResponse.



54
55
56
57
58
59
60
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 54

def initialize(access_token = SKIP, token_type = 'bearer',
               expires_in = SKIP, scope = 'basic openid')
  @access_token = access_token unless access_token == SKIP
  @token_type = token_type unless token_type == SKIP
  @expires_in = expires_in unless expires_in == SKIP
  @scope = scope unless scope == SKIP
end

Instance Attribute Details

#access_tokenString

It is the token used in the requests that required to authenticate an user.

Returns:

  • (String)


15
16
17
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 15

def access_token
  @access_token
end

#expires_inInteger

validity of the access token in seconds

Returns:

  • (Integer)


23
24
25
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 23

def expires_in
  @expires_in
end

#scopeString

scope for the authentication protocol

Returns:

  • (String)


27
28
29
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 27

def scope
  @scope
end

#token_typeString

type of token provided

Returns:

  • (String)


19
20
21
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 19

def token_type
  @token_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 63

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  access_token = hash.key?('access_token') ? hash['access_token'] : SKIP
  token_type = hash['token_type'] ||= 'bearer'
  expires_in = hash.key?('expires_in') ? hash['expires_in'] : SKIP
  scope = hash['scope'] ||= 'basic openid'

  # Create object from extracted values.

  MppAccesTokenResponse.new(access_token,
                            token_type,
                            expires_in,
                            scope)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['access_token'] = 'access_token'
  @_hash['token_type'] = 'token_type'
  @_hash['expires_in'] = 'expires_in'
  @_hash['scope'] = 'scope'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 40

def self.optionals
  %w[
    access_token
    token_type
    expires_in
    scope
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



87
88
89
90
91
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 87

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} access_token: #{@access_token.inspect}, token_type: #{@token_type.inspect},"\
  " expires_in: #{@expires_in.inspect}, scope: #{@scope.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



80
81
82
83
84
# File 'lib/shell_smart_pay_api/models/mpp_acces_token_response.rb', line 80

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} access_token: #{@access_token}, token_type: #{@token_type}, expires_in:"\
  " #{@expires_in}, scope: #{@scope}>"
end