Class: PaypalServerSdk::SetupTokenRequest

Inherits:
BaseModel
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(payment_source:, customer: SKIP) ⇒ SetupTokenRequest

Returns a new instance of SetupTokenRequest.



41
42
43
44
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 41

def initialize(payment_source:, customer: SKIP)
  @customer = customer unless customer == SKIP
  @payment_source = payment_source
end

Instance Attribute Details

#customerCustomerRequest

Customer in merchant’s or partner’s system of records.

Returns:



15
16
17
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 15

def customer
  @customer
end

#payment_sourceSetupTokenRequestPaymentSource

The payment method to vault with the instrument details.



19
20
21
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 19

def payment_source
  @payment_source
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 47

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 = CustomerRequest.from_hash(hash['customer']) if hash['customer']

  # Create object from extracted values.
  SetupTokenRequest.new(payment_source: payment_source,
                        customer: customer)
end

.namesObject

A mapping from model property names to API property names.



22
23
24
25
26
27
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 22

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['customer'] = 'customer'
  @_hash['payment_source'] = 'payment_source'
  @_hash
end

.nullablesObject

An array for nullable fields



37
38
39
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 37

def self.nullables
  []
end

.optionalsObject

An array for optional fields



30
31
32
33
34
# File 'lib/paypal_server_sdk/models/setup_token_request.rb', line 30

def self.optionals
  %w[
    customer
  ]
end