Class: FdxV660Api::BalanceTransferOrCashAdvance

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb

Overview

A single balance transfer or cash advance category on the account and its associated annual percentage rate (APR) and fee

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(type: SKIP, apr: SKIP, fee: 0, fee_percentage: SKIP, additional_properties: nil) ⇒ BalanceTransferOrCashAdvance

Returns a new instance of BalanceTransferOrCashAdvance.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 58

def initialize(type: SKIP, apr: SKIP, fee: 0, fee_percentage: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @type = type unless type == SKIP
  @apr = apr unless apr == SKIP
  @fee = fee unless fee == SKIP
  @fee_percentage = fee_percentage unless fee_percentage == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#aprFloat

The annual percentage rate (APR) charged for this type of transfer or advance

Returns:

  • (Float)


21
22
23
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 21

def apr
  @apr
end

#feeFloat

The minimum fee charged for this type of transfer or advance. The value is zero if not charged on this type

Returns:

  • (Float)


26
27
28
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 26

def fee
  @fee
end

#fee_percentageFloat

The fee charged as a percentage of the transfer or advance. If percentage result is smaller than fee, the fee amount is charged

Returns:

  • (Float)


31
32
33
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 31

def fee_percentage
  @fee_percentage
end

#typeBalanceTransferAndCashAdvanceType2

The type of transfer or advance, BALANCE_TRANSFER, CASH_ADVANCE, DIRECT_DEPOSIT_CASH_ADVANCE, CHECK_CASH_ADVANCE, OTC_CASH_ADVANCE



16
17
18
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 16

def type
  @type
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
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  type = hash.key?('type') ? hash['type'] : SKIP
  apr = hash.key?('apr') ? hash['apr'] : SKIP
  fee = hash['fee'] ||= 0
  fee_percentage = hash.key?('feePercentage') ? hash['feePercentage'] : 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.
  BalanceTransferOrCashAdvance.new(type: type,
                                   apr: apr,
                                   fee: fee,
                                   fee_percentage: fee_percentage,
                                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



34
35
36
37
38
39
40
41
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 34

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['type'] = 'type'
  @_hash['apr'] = 'apr'
  @_hash['fee'] = 'fee'
  @_hash['fee_percentage'] = 'feePercentage'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 44

def self.optionals
  %w[
    type
    apr
    fee
    fee_percentage
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



97
98
99
100
101
102
103
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 97

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



113
114
115
116
117
118
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 113

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type.inspect}, apr: #{@apr.inspect}, fee: #{@fee.inspect},"\
  " fee_percentage: #{@fee_percentage.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



106
107
108
109
110
# File 'lib/fdx_v660_api/models/balance_transfer_or_cash_advance.rb', line 106

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} type: #{@type}, apr: #{@apr}, fee: #{@fee}, fee_percentage:"\
  " #{@fee_percentage}, additional_properties: #{@additional_properties}>"
end