Class: PaypalServerSdk::SetupTokenResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::SetupTokenResponse
- Defined in:
- lib/paypal_server_sdk/models/setup_token_response.rb
Overview
Minimal representation of a cached setup token.
Instance Attribute Summary collapse
-
#customer ⇒ CustomerRequest
Customer in merchant’s or partner’s system of records.
-
#id ⇒ String
The PayPal-generated ID for the vault token.
-
#links ⇒ Array[LinkDescription]
An array of related [HATEOAS links](/api/rest/responses/#hateoas).
-
#ordinal ⇒ Integer
Ordinal number for sorting.
-
#payment_source ⇒ SetupTokenResponsePaymentSource
The setup payment method details.
-
#status ⇒ String
The status of the payment token.
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.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(id: SKIP, ordinal: SKIP, customer: SKIP, status: 'CREATED', payment_source: SKIP, links: SKIP) ⇒ SetupTokenResponse
constructor
A new instance of SetupTokenResponse.
Methods inherited from BaseModel
Constructor Details
#initialize(id: SKIP, ordinal: SKIP, customer: SKIP, status: 'CREATED', payment_source: SKIP, links: SKIP) ⇒ SetupTokenResponse
Returns a new instance of SetupTokenResponse.
65 66 67 68 69 70 71 72 73 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 65 def initialize(id: SKIP, ordinal: SKIP, customer: SKIP, status: 'CREATED', payment_source: SKIP, links: SKIP) @id = id unless id == SKIP @ordinal = ordinal unless ordinal == SKIP @customer = customer unless customer == SKIP @status = status unless status == SKIP @payment_source = payment_source unless payment_source == SKIP @links = links unless links == SKIP end |
Instance Attribute Details
#customer ⇒ CustomerRequest
Customer in merchant’s or partner’s system of records.
22 23 24 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 22 def customer @customer end |
#id ⇒ String
The PayPal-generated ID for the vault token.
14 15 16 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 14 def id @id end |
#links ⇒ Array[LinkDescription]
An array of related [HATEOAS links](/api/rest/responses/#hateoas).
34 35 36 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 34 def links @links end |
#ordinal ⇒ Integer
Ordinal number for sorting.
18 19 20 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 18 def ordinal @ordinal end |
#payment_source ⇒ SetupTokenResponsePaymentSource
The setup payment method details.
30 31 32 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 30 def payment_source @payment_source end |
#status ⇒ String
The status of the payment token.
26 27 28 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 26 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP ordinal = hash.key?('ordinal') ? hash['ordinal'] : SKIP customer = CustomerRequest.from_hash(hash['customer']) if hash['customer'] status = hash['status'] ||= 'CREATED' payment_source = SetupTokenResponsePaymentSource.from_hash(hash['payment_source']) if hash['payment_source'] # Parameter is an array, so we need to iterate through it links = nil unless hash['links'].nil? links = [] hash['links'].each do |structure| links << (LinkDescription.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') # Create object from extracted values. SetupTokenResponse.new(id: id, ordinal: ordinal, customer: customer, status: status, payment_source: payment_source, links: links) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['ordinal'] = 'ordinal' @_hash['customer'] = 'customer' @_hash['status'] = 'status' @_hash['payment_source'] = 'payment_source' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 49 def self.optionals %w[ id ordinal customer status payment_source links ] end |