Class: PaypalServerSdk::VaultResponse

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

Overview

The details about a saved payment source.

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(id: SKIP, status: SKIP, customer: SKIP, links: SKIP) ⇒ VaultResponse

Returns a new instance of VaultResponse.



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

def initialize(id: SKIP, status: SKIP, customer: SKIP, links: SKIP)
  @id = id unless id == SKIP
  @status = status unless status == SKIP
  @customer = customer unless customer == SKIP
  @links = links unless links == SKIP
end

Instance Attribute Details

#customerVaultCustomer

This object represents a merchant’s customer, allowing them to store contact details, and track all payments associated with the same customer.

Returns:



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

def customer
  @customer
end

#idString

The PayPal-generated ID for the saved payment source.

Returns:

  • (String)


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

def id
  @id
end

An array of request-related HATEOAS links.

Returns:



27
28
29
# File 'lib/paypal_server_sdk/models/vault_response.rb', line 27

def links
  @links
end

#statusVaultStatus

The vault status.

Returns:



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

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/paypal_server_sdk/models/vault_response.rb', line 62

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.

  id = hash.key?('id') ? hash['id'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  customer = VaultCustomer.from_hash(hash['customer']) if hash['customer']
  # 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.

  VaultResponse.new(id: id,
                    status: status,
                    customer: customer,
                    links: links)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['status'] = 'status'
  @_hash['customer'] = 'customer'
  @_hash['links'] = 'links'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/paypal_server_sdk/models/vault_response.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    id
    status
    customer
    links
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



94
95
96
97
98
# File 'lib/paypal_server_sdk/models/vault_response.rb', line 94

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

#to_sObject

Provides a human-readable string representation of the object.



88
89
90
91
# File 'lib/paypal_server_sdk/models/vault_response.rb', line 88

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