Class: PaypalServerSdk::SetupTokenRequestPaymentSource

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/setup_token_request_payment_source.rb

Overview

The payment method to vault with the instrument details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(card: SKIP, paypal: SKIP, venmo: SKIP, token: SKIP) ⇒ SetupTokenRequestPaymentSource

Returns a new instance of SetupTokenRequestPaymentSource.



53
54
55
56
57
58
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 53

def initialize(card: SKIP, paypal: SKIP, venmo: SKIP, token: SKIP)
  @card = card unless card == SKIP
  @paypal = paypal unless paypal == SKIP
  @venmo = venmo unless venmo == SKIP
  @token = token unless token == SKIP
end

Instance Attribute Details

#cardSetupTokenRequestCard

A Resource representing a request to vault a Card.



14
15
16
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 14

def card
  @card
end

#paypalVaultPaypalWalletRequest

A resource representing a request to vault PayPal Wallet.



18
19
20
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 18

def paypal
  @paypal
end

#tokenVaultTokenRequest

The Tokenized Payment Source representing a Request to Vault a Token.

Returns:



26
27
28
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 26

def token
  @token
end

#venmoVaultVenmoRequest

A resource representing a request to vault PayPal Wallet.

Returns:



22
23
24
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 22

def venmo
  @venmo
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = SetupTokenRequestCard.from_hash(hash['card']) if hash['card']
  paypal = VaultPaypalWalletRequest.from_hash(hash['paypal']) if hash['paypal']
  venmo = VaultVenmoRequest.from_hash(hash['venmo']) if hash['venmo']
  token = VaultTokenRequest.from_hash(hash['token']) if hash['token']

  # Create object from extracted values.
  SetupTokenRequestPaymentSource.new(card: card,
                                     paypal: paypal,
                                     venmo: venmo,
                                     token: token)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['card'] = 'card'
  @_hash['paypal'] = 'paypal'
  @_hash['venmo'] = 'venmo'
  @_hash['token'] = 'token'
  @_hash
end

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 49

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
46
# File 'lib/paypal_server_sdk/models/setup_token_request_payment_source.rb', line 39

def self.optionals
  %w[
    card
    paypal
    venmo
    token
  ]
end