Class: PaypalServerSdk::SetupTokenResponsePaymentSource

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

Overview

The setup payment method 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) ⇒ SetupTokenResponsePaymentSource

Returns a new instance of SetupTokenResponsePaymentSource.



47
48
49
50
51
# File 'lib/paypal_server_sdk/models/setup_token_response_payment_source.rb', line 47

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

Instance Attribute Details

#cardSetupTokenResponseCard

TODO: Write general description for this method



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

def card
  @card
end

#paypalPaypalPaymentToken

TODO: Write general description for this method

Returns:



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

def paypal
  @paypal
end

#venmoVenmoPaymentToken

TODO: Write general description for this method

Returns:



22
23
24
# File 'lib/paypal_server_sdk/models/setup_token_response_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.



54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/paypal_server_sdk/models/setup_token_response_payment_source.rb', line 54

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = SetupTokenResponseCard.from_hash(hash['card']) if hash['card']
  paypal = PaypalPaymentToken.from_hash(hash['paypal']) if hash['paypal']
  venmo = VenmoPaymentToken.from_hash(hash['venmo']) if hash['venmo']

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

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
31
# File 'lib/paypal_server_sdk/models/setup_token_response_payment_source.rb', line 25

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

.nullablesObject

An array for nullable fields



43
44
45
# File 'lib/paypal_server_sdk/models/setup_token_response_payment_source.rb', line 43

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
40
# File 'lib/paypal_server_sdk/models/setup_token_response_payment_source.rb', line 34

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