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

#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.



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

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

#customerCustomerRequest

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

Returns:



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

def customer
  @customer
end

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

Returns:



30
31
32
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 30

def links
  @links
end

#payment_tokensArray[PaymentTokenResponse]

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

Returns:



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

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.



69
70
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
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 69

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 = CustomerRequest.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.



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

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



55
56
57
# File 'lib/paypal_server_sdk/models/customer_vault_payment_tokens_response.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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