Class: PaypalServerSdk::SetupTokenRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::SetupTokenRequest
- Defined in:
- lib/paypal_server_sdk/models/setup_token_request.rb
Overview
Setup Token Request where the ‘source` defines the type of instrument to be stored.
Instance Attribute Summary collapse
-
#customer ⇒ Customer
This object defines a customer in your system.
-
#payment_source ⇒ SetupTokenRequestPaymentSource
The payment method to vault with the instrument 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(payment_source:, customer: SKIP) ⇒ SetupTokenRequest
constructor
A new instance of SetupTokenRequest.
-
#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(payment_source:, customer: SKIP) ⇒ SetupTokenRequest
Returns a new instance of SetupTokenRequest.
42 43 44 45 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 42 def initialize(payment_source:, customer: SKIP) @customer = customer unless customer == SKIP @payment_source = payment_source 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.
16 17 18 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 16 def customer @customer end |
#payment_source ⇒ SetupTokenRequestPaymentSource
The payment method to vault with the instrument details.
20 21 22 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 20 def payment_source @payment_source end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 48 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. payment_source = SetupTokenRequestPaymentSource.from_hash(hash['payment_source']) if hash['payment_source'] customer = Customer.from_hash(hash['customer']) if hash['customer'] # Create object from extracted values. SetupTokenRequest.new(payment_source: payment_source, customer: customer) end |
.names ⇒ Object
A mapping from model property names to API property names.
23 24 25 26 27 28 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 23 def self.names @_hash = {} if @_hash.nil? @_hash['customer'] = 'customer' @_hash['payment_source'] = 'payment_source' @_hash end |
.nullables ⇒ Object
An array for nullable fields
38 39 40 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 38 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
31 32 33 34 35 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 31 def self.optionals %w[ customer ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
68 69 70 71 72 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 68 def inspect class_name = self.class.name.split('::').last "<#{class_name} customer: #{@customer.inspect}, payment_source:"\ " #{@payment_source.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
62 63 64 65 |
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 62 def to_s class_name = self.class.name.split('::').last "<#{class_name} customer: #{@customer}, payment_source: #{@payment_source}>" end |