Class: PaypalServerSdk::PaymentTokenResponsePaymentSource

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

Overview

The vaulted payment method details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(card: SKIP, paypal: SKIP, venmo: SKIP, apple_pay: SKIP) ⇒ PaymentTokenResponsePaymentSource

Returns a new instance of PaymentTokenResponsePaymentSource.



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

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

Instance Attribute Details

#apple_payApplePayPaymentToken

A resource representing a response for Apple Pay.



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

def apple_pay
  @apple_pay
end

#cardCardPaymentTokenEntity

Full representation of a Card Payment Token including network token.



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

def card
  @card
end

#paypalPaypalPaymentToken

Full representation of a Card Payment Token including network token.

Returns:



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

def paypal
  @paypal
end

#venmoVenmoPaymentToken

Full representation of a Card Payment Token including network token.

Returns:



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



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  card = CardPaymentTokenEntity.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']
  apple_pay = ApplePayPaymentToken.from_hash(hash['apple_pay']) if hash['apple_pay']

  # Create object from extracted values.
  PaymentTokenResponsePaymentSource.new(card: card,
                                        paypal: paypal,
                                        venmo: venmo,
                                        apple_pay: apple_pay)
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/payment_token_response_payment_source.rb', line 29

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

.nullablesObject

An array for nullable fields



49
50
51
# File 'lib/paypal_server_sdk/models/payment_token_response_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/payment_token_response_payment_source.rb', line 39

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

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



85
86
87
88
89
# File 'lib/paypal_server_sdk/models/payment_token_response_payment_source.rb', line 85

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card.inspect}, paypal: #{@paypal.inspect}, venmo:"\
  " #{@venmo.inspect}, apple_pay: #{@apple_pay.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



78
79
80
81
82
# File 'lib/paypal_server_sdk/models/payment_token_response_payment_source.rb', line 78

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} card: #{@card}, paypal: #{@paypal}, venmo: #{@venmo}, apple_pay:"\
  " #{@apple_pay}>"
end