Class: PaypalServerSdk::BalanceInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::BalanceInformation
- Defined in:
- lib/paypal_server_sdk/models/balance_information.rb
Overview
The Balance information.
Instance Attribute Summary collapse
-
#available_balance ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
-
#currency ⇒ String
The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency.
-
#primary ⇒ TrueClass | FalseClass
Optional field representing if the currency is primary currency or not.
-
#total_balance ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
-
#withheld_balance ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(currency:, total_balance:, primary: SKIP, available_balance: SKIP, withheld_balance: SKIP) ⇒ BalanceInformation
constructor
A new instance of BalanceInformation.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(currency:, total_balance:, primary: SKIP, available_balance: SKIP, withheld_balance: SKIP) ⇒ BalanceInformation
Returns a new instance of BalanceInformation.
62 63 64 65 66 67 68 69 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 62 def initialize(currency:, total_balance:, primary: SKIP, available_balance: SKIP, withheld_balance: SKIP) @currency = currency @primary = primary unless primary == SKIP @total_balance = total_balance @available_balance = available_balance unless available_balance == SKIP @withheld_balance = withheld_balance unless withheld_balance == SKIP end |
Instance Attribute Details
#available_balance ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
30 31 32 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 30 def available_balance @available_balance end |
#currency ⇒ String
The [three-character ISO-4217 currency code](/docs/integration/direct/rest/currency-codes/) that identifies the currency.
16 17 18 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 16 def currency @currency end |
#primary ⇒ TrueClass | FalseClass
Optional field representing if the currency is primary currency or not.
20 21 22 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 20 def primary @primary end |
#total_balance ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
25 26 27 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 25 def total_balance @total_balance end |
#withheld_balance ⇒ Money
The currency and amount for a financial transaction, such as a balance or payment due.
35 36 37 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 35 def withheld_balance @withheld_balance end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 72 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. currency = hash.key?('currency') ? hash['currency'] : nil total_balance = Money.from_hash(hash['total_balance']) if hash['total_balance'] primary = hash.key?('primary') ? hash['primary'] : SKIP available_balance = Money.from_hash(hash['available_balance']) if hash['available_balance'] withheld_balance = Money.from_hash(hash['withheld_balance']) if hash['withheld_balance'] # Create object from extracted values. BalanceInformation.new(currency: currency, total_balance: total_balance, primary: primary, available_balance: available_balance, withheld_balance: withheld_balance) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['currency'] = 'currency' @_hash['primary'] = 'primary' @_hash['total_balance'] = 'total_balance' @_hash['available_balance'] = 'available_balance' @_hash['withheld_balance'] = 'withheld_balance' @_hash end |
.nullables ⇒ Object
An array for nullable fields
58 59 60 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 58 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 49 def self.optionals %w[ primary available_balance withheld_balance ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 104 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 99 def inspect class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency.inspect}, primary: #{@primary.inspect},"\ " total_balance: #{@total_balance.inspect}, available_balance:"\ " #{@available_balance.inspect}, withheld_balance: #{@withheld_balance.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
91 92 93 94 95 96 |
# File 'lib/paypal_server_sdk/models/balance_information.rb', line 91 def to_s class_name = self.class.name.split('::').last "<#{class_name} currency: #{@currency}, primary: #{@primary}, total_balance:"\ " #{@total_balance}, available_balance: #{@available_balance}, withheld_balance:"\ " #{@withheld_balance}>" end |