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 ⇒ Customer
This object defines a customer in your system.
-
#id ⇒ String
The PayPal-generated ID for the vault token.
-
#links ⇒ Array[LinkDescription]
An array of related [HATEOAS links](/api/rest/responses/#hateoas).
-
#payment_source ⇒ SetupTokenResponsePaymentSource
The setup payment method details.
-
#status ⇒ PaymentTokenStatus
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, customer: SKIP, status: PaymentTokenStatus::CREATED, payment_source: SKIP, links: SKIP) ⇒ SetupTokenResponse
constructor
A new instance of SetupTokenResponse.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(id: SKIP, customer: SKIP, status: PaymentTokenStatus::CREATED, payment_source: SKIP, links: SKIP) ⇒ SetupTokenResponse
Returns a new instance of SetupTokenResponse.
60 61 62 63 64 65 66 67 68 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 60 def initialize(id: SKIP, customer: SKIP, status: PaymentTokenStatus::CREATED, payment_source: SKIP, links: SKIP) @id = id unless id == 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 ⇒ Customer
This object defines a customer in your system. Use it to manage customer profiles, save payment methods and contact details.
19 20 21 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 19 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).
31 32 33 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 31 def links @links end |
#payment_source ⇒ SetupTokenResponsePaymentSource
The setup payment method details.
27 28 29 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 27 def payment_source @payment_source end |
#status ⇒ PaymentTokenStatus
The status of the payment token.
23 24 25 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 23 def status @status end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 71 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP customer = Customer.from_hash(hash['customer']) if hash['customer'] status = hash['status'] ||= PaymentTokenStatus::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, customer: customer, status: status, payment_source: payment_source, links: links) end |
.names ⇒ Object
A mapping from model property names to API property names.
34 35 36 37 38 39 40 41 42 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 34 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['customer'] = 'customer' @_hash['status'] = 'status' @_hash['payment_source'] = 'payment_source' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
56 57 58 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 56 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 52 53 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 45 def self.optionals %w[ id customer status payment_source links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
107 108 109 110 111 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 107 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, customer: #{@customer.inspect}, status:"\ " #{@status.inspect}, payment_source: #{@payment_source.inspect}, links: #{@links.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
100 101 102 103 104 |
# File 'lib/paypal_server_sdk/models/setup_token_response.rb', line 100 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, customer: #{@customer}, status: #{@status}, payment_source:"\ " #{@payment_source}, links: #{@links}>" end |