Class: MundiApi::CreateTokenRequest
- Defined in:
- lib/mundi_api/models/create_token_request.rb
Overview
Token data
Instance Attribute Summary collapse
-
#card ⇒ CreateCardTokenRequest
Card data.
-
#type ⇒ String
Token type.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(type = 'card', card = nil) ⇒ CreateTokenRequest
constructor
A new instance of CreateTokenRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(type = 'card', card = nil) ⇒ CreateTokenRequest
Returns a new instance of CreateTokenRequest.
25 26 27 28 29 |
# File 'lib/mundi_api/models/create_token_request.rb', line 25 def initialize(type = 'card', card = nil) @type = type @card = card end |
Instance Attribute Details
#card ⇒ CreateCardTokenRequest
Card data
13 14 15 |
# File 'lib/mundi_api/models/create_token_request.rb', line 13 def card @card end |
#type ⇒ String
Token type
9 10 11 |
# File 'lib/mundi_api/models/create_token_request.rb', line 9 def type @type end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mundi_api/models/create_token_request.rb', line 32 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. type = hash['type'] ||= 'card' card = CreateCardTokenRequest.from_hash(hash['card']) if hash['card'] # Create object from extracted values. CreateTokenRequest.new(type, card) end |
.names ⇒ Object
A mapping from model property names to API property names.
16 17 18 19 20 21 22 23 |
# File 'lib/mundi_api/models/create_token_request.rb', line 16 def self.names if @_hash.nil? @_hash = {} @_hash['type'] = 'type' @_hash['card'] = 'card' end @_hash end |