Class: PaypalServerSdk::BalancesResponse

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

Overview

The balances response information.

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(balances: SKIP, account_id: SKIP, as_of_time: SKIP, last_refresh_time: SKIP) ⇒ BalancesResponse

Returns a new instance of BalancesResponse.



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

def initialize(balances: SKIP, account_id: SKIP, as_of_time: SKIP,
               last_refresh_time: SKIP)
  @balances = balances unless balances == SKIP
  @account_id =  unless  == SKIP
  @as_of_time = as_of_time unless as_of_time == SKIP
  @last_refresh_time = last_refresh_time unless last_refresh_time == SKIP
end

Instance Attribute Details

#account_idString

The PayPal payer ID, which is a masked version of the PayPal account number intended for use with third parties. The account number is reversibly encrypted and a proprietary variant of Base32 is used to encode the result.

Returns:

  • (String)


21
22
23
# File 'lib/paypal_server_sdk/models/balances_response.rb', line 21

def 
  @account_id
end

#as_of_timeString

The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.

Returns:

  • (String)


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

def as_of_time
  @as_of_time
end

#balancesArray[BalanceInformation]

An array of balance detail objects.

Returns:



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

def balances
  @balances
end

#last_refresh_timeString

The date and time, in [Internet date and time format](tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates.

Returns:

  • (String)


35
36
37
# File 'lib/paypal_server_sdk/models/balances_response.rb', line 35

def last_refresh_time
  @last_refresh_time
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
# File 'lib/paypal_server_sdk/models/balances_response.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  # Parameter is an array, so we need to iterate through it
  balances = nil
  unless hash['balances'].nil?
    balances = []
    hash['balances'].each do |structure|
      balances << (BalanceInformation.from_hash(structure) if structure)
    end
  end

  balances = SKIP unless hash.key?('balances')
   = hash.key?('account_id') ? hash['account_id'] : SKIP
  as_of_time = hash.key?('as_of_time') ? hash['as_of_time'] : SKIP
  last_refresh_time =
    hash.key?('last_refresh_time') ? hash['last_refresh_time'] : SKIP

  # Create object from extracted values.
  BalancesResponse.new(balances: balances,
                       account_id: ,
                       as_of_time: as_of_time,
                       last_refresh_time: last_refresh_time)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
45
# File 'lib/paypal_server_sdk/models/balances_response.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['balances'] = 'balances'
  @_hash['account_id'] = 'account_id'
  @_hash['as_of_time'] = 'as_of_time'
  @_hash['last_refresh_time'] = 'last_refresh_time'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/paypal_server_sdk/models/balances_response.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
51
52
53
54
55
# File 'lib/paypal_server_sdk/models/balances_response.rb', line 48

def self.optionals
  %w[
    balances
    account_id
    as_of_time
    last_refresh_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



105
106
107
108
109
# File 'lib/paypal_server_sdk/models/balances_response.rb', line 105

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} balances: #{@balances.inspect}, account_id: #{@account_id.inspect},"\
  " as_of_time: #{@as_of_time.inspect}, last_refresh_time: #{@last_refresh_time.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



98
99
100
101
102
# File 'lib/paypal_server_sdk/models/balances_response.rb', line 98

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} balances: #{@balances}, account_id: #{@account_id}, as_of_time:"\
  " #{@as_of_time}, last_refresh_time: #{@last_refresh_time}>"
end