Class: PaypalServerSdk::PaymentTokenResponse
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::PaymentTokenResponse
- Defined in:
- lib/paypal_server_sdk/models/payment_token_response.rb
Overview
Full representation of a saved payment token.
Instance Attribute Summary collapse
-
#customer ⇒ CustomerResponse
Customer in merchant’s or partner’s system of records.
-
#id ⇒ String
The PayPal-generated ID for the vaulted payment source.
-
#links ⇒ Array[LinkDescription]
An array of related [HATEOAS links](/api/rest/responses/#hateoas).
-
#payment_source ⇒ PaymentTokenResponsePaymentSource
The vaulted payment method details.
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, payment_source: SKIP, links: SKIP) ⇒ PaymentTokenResponse
constructor
A new instance of PaymentTokenResponse.
-
#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, payment_source: SKIP, links: SKIP) ⇒ PaymentTokenResponse
Returns a new instance of PaymentTokenResponse.
55 56 57 58 59 60 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 55 def initialize(id: SKIP, customer: SKIP, payment_source: SKIP, links: SKIP) @id = id unless id == SKIP @customer = customer unless customer == SKIP @payment_source = payment_source unless payment_source == SKIP @links = links unless links == SKIP end |
Instance Attribute Details
#customer ⇒ CustomerResponse
Customer in merchant’s or partner’s system of records.
20 21 22 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 20 def customer @customer end |
#id ⇒ String
The PayPal-generated ID for the vaulted payment source. This ID should be stored on the merchant’s server so the saved payment source can be used for future transactions.
16 17 18 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 16 def id @id end |
#links ⇒ Array[LinkDescription]
An array of related [HATEOAS links](/api/rest/responses/#hateoas).
28 29 30 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 28 def links @links end |
#payment_source ⇒ PaymentTokenResponsePaymentSource
The vaulted payment method details.
24 25 26 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 24 def payment_source @payment_source 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 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash.key?('id') ? hash['id'] : SKIP customer = CustomerResponse.from_hash(hash['customer']) if hash['customer'] payment_source = PaymentTokenResponsePaymentSource.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. PaymentTokenResponse.new(id: id, customer: customer, payment_source: payment_source, links: links) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['customer'] = 'customer' @_hash['payment_source'] = 'payment_source' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 48 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 41 def self.optionals %w[ id customer payment_source links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
97 98 99 100 101 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 97 def inspect class_name = self.class.name.split('::').last "<#{class_name} id: #{@id.inspect}, customer: #{@customer.inspect}, payment_source:"\ " #{@payment_source.inspect}, links: #{@links.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
90 91 92 93 94 |
# File 'lib/paypal_server_sdk/models/payment_token_response.rb', line 90 def to_s class_name = self.class.name.split('::').last "<#{class_name} id: #{@id}, customer: #{@customer}, payment_source: #{@payment_source},"\ " links: #{@links}>" end |