Class: VisaAcceptanceMergedSpec::AccountFeatures2

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/account_features2.rb

Overview

AccountFeatures2 Model.

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(balance_amount: SKIP, previous_balance_amount: SKIP, currency: SKIP, additional_properties: nil) ⇒ AccountFeatures2

Returns a new instance of AccountFeatures2.



60
61
62
63
64
65
66
67
68
69
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 60

def initialize(balance_amount: SKIP, previous_balance_amount: SKIP,
               currency: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @balance_amount = balance_amount unless balance_amount == SKIP
  @previous_balance_amount = previous_balance_amount unless previous_balance_amount == SKIP
  @currency = currency unless currency == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#balance_amountString

Remaining balance on the account. Returned by authorization service.

PIN debit

Remaining balance on the prepaid card. Returned by PIN debit purchase.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 18

def balance_amount
  @balance_amount
end

#currencyString

Currency of the remaining balance on the account. For the possible values, see the [ISO Standard Currency Codes.]( Returned by authorization service.

PIN debit

Currency of the remaining balance on the prepaid card. Returned by PIN debit purchase.

Returns:

  • (String)


35
36
37
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 35

def currency
  @currency
end

#previous_balance_amountString

Remaining balance on the account. Returned by authorization service.

PIN debit

Remaining balance on the prepaid card. Returned by PIN debit purchase.

Returns:

  • (String)


26
27
28
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 26

def previous_balance_amount
  @previous_balance_amount
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
89
90
91
92
93
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  balance_amount = hash.key?('balanceAmount') ? hash['balanceAmount'] : SKIP
  previous_balance_amount =
    hash.key?('previousBalanceAmount') ? hash['previousBalanceAmount'] : SKIP
  currency = hash.key?('currency') ? hash['currency'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  AccountFeatures2.new(balance_amount: balance_amount,
                       previous_balance_amount: previous_balance_amount,
                       currency: currency,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



38
39
40
41
42
43
44
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 38

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['balance_amount'] = 'balanceAmount'
  @_hash['previous_balance_amount'] = 'previousBalanceAmount'
  @_hash['currency'] = 'currency'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



47
48
49
50
51
52
53
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 47

def self.optionals
  %w[
    balance_amount
    previous_balance_amount
    currency
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} balance_amount: #{@balance_amount.inspect}, previous_balance_amount:"\
  " #{@previous_balance_amount.inspect}, currency: #{@currency.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
100
101
# File 'lib/visa_acceptance_merged_spec/models/account_features2.rb', line 96

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} balance_amount: #{@balance_amount}, previous_balance_amount:"\
  " #{@previous_balance_amount}, currency: #{@currency}, additional_properties:"\
  " #{@additional_properties}>"
end