Class: PaypalServerSdk::CustomerVaultPaymentTokensResponse

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

Overview

Collection of payment tokens saved for a given customer.

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(total_items: SKIP, total_pages: SKIP, customer: SKIP, payment_tokens: SKIP, links: SKIP) ⇒ CustomerVaultPaymentTokensResponse

Returns a new instance of CustomerVaultPaymentTokensResponse.



61
62
63
64
65
66
67
68
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 61

def initialize(total_items: SKIP, total_pages: SKIP, customer: SKIP,
               payment_tokens: SKIP, links: SKIP)
  @total_items = total_items unless total_items == SKIP
  @total_pages = total_pages unless total_pages == SKIP
  @customer = customer unless customer == SKIP
  @payment_tokens = payment_tokens unless payment_tokens == SKIP
  @links = links unless links == SKIP
end

Instance Attribute Details

#customerVaultResponseCustomer

This object defines a customer in your system. Use it to manage customer profiles, save payment methods and contact details.



23
24
25
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 23

def customer
  @customer
end

An array of related [HATEOAS links](/api/rest/responses/#hateoas).

Returns:



32
33
34
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 32

def links
  @links
end

#payment_tokensArray[PaymentTokenResponse]

This object defines a customer in your system. Use it to manage customer profiles, save payment methods and contact details.

Returns:



28
29
30
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 28

def payment_tokens
  @payment_tokens
end

#total_itemsInteger

Total number of items.

Returns:

  • (Integer)


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

def total_items
  @total_items
end

#total_pagesInteger

Total number of pages.

Returns:

  • (Integer)


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

def total_pages
  @total_pages
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total_items = hash.key?('total_items') ? hash['total_items'] : SKIP
  total_pages = hash.key?('total_pages') ? hash['total_pages'] : SKIP
  customer = VaultResponseCustomer.from_hash(hash['customer']) if hash['customer']
  # Parameter is an array, so we need to iterate through it
  payment_tokens = nil
  unless hash['payment_tokens'].nil?
    payment_tokens = []
    hash['payment_tokens'].each do |structure|
      payment_tokens << (PaymentTokenResponse.from_hash(structure) if structure)
    end
  end

  payment_tokens = SKIP unless hash.key?('payment_tokens')
  # Parameter is an array, so we need to iterate through it
  links = nil
  unless hash['links'].nil?
    links = []
    hash['links'].each do |structure|
      links << (LinkDescription.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('links')

  # Create object from extracted values.
  CustomerVaultPaymentTokensResponse.new(total_items: total_items,
                                         total_pages: total_pages,
                                         customer: customer,
                                         payment_tokens: payment_tokens,
                                         links: links)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
43
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_items'] = 'total_items'
  @_hash['total_pages'] = 'total_pages'
  @_hash['customer'] = 'customer'
  @_hash['payment_tokens'] = 'payment_tokens'
  @_hash['links'] = 'links'
  @_hash
end

.nullablesObject

An array for nullable fields



57
58
59
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 57

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
54
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 46

def self.optionals
  %w[
    total_items
    total_pages
    customer
    payment_tokens
    links
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 115

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} total_items: #{@total_items.inspect}, total_pages: #{@total_pages.inspect},"\
  " customer: #{@customer.inspect}, payment_tokens: #{@payment_tokens.inspect}, links:"\
  " #{@links.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 108

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} total_items: #{@total_items}, total_pages: #{@total_pages}, customer:"\
  " #{@customer}, payment_tokens: #{@payment_tokens}, links: #{@links}>"
end