Class: FdxV660Api::BillEntity

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

Overview

A statement of a payment due on an account

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(total_payment_due: SKIP, minimum_payment_due: SKIP, due_date: SKIP, auto_pay_enabled: SKIP, auto_pay_amount: SKIP, auto_pay_date: SKIP, past_due_amount: SKIP, last_payment_amount: SKIP, last_payment_date: SKIP, statement_balance: SKIP, statement_date: SKIP, additional_properties: nil) ⇒ BillEntity

Returns a new instance of BillEntity.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 102

def initialize(total_payment_due: SKIP, minimum_payment_due: SKIP,
               due_date: SKIP, auto_pay_enabled: SKIP,
               auto_pay_amount: SKIP, auto_pay_date: SKIP,
               past_due_amount: SKIP, last_payment_amount: SKIP,
               last_payment_date: SKIP, statement_balance: SKIP,
               statement_date: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @total_payment_due = total_payment_due unless total_payment_due == SKIP
  @minimum_payment_due = minimum_payment_due unless minimum_payment_due == SKIP
  @due_date = due_date unless due_date == SKIP
  @auto_pay_enabled = auto_pay_enabled unless auto_pay_enabled == SKIP
  @auto_pay_amount = auto_pay_amount unless auto_pay_amount == SKIP
  @auto_pay_date = auto_pay_date unless auto_pay_date == SKIP
  @past_due_amount = past_due_amount unless past_due_amount == SKIP
  @last_payment_amount = last_payment_amount unless last_payment_amount == SKIP
  @last_payment_date = last_payment_date unless last_payment_date == SKIP
  @statement_balance = statement_balance unless statement_balance == SKIP
  @statement_date = statement_date unless statement_date == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#auto_pay_amountFloat

The amount of money the user has set to autopay this bill as indicated on the statement

Returns:

  • (Float)


34
35
36
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 34

def auto_pay_amount
  @auto_pay_amount
end

#auto_pay_dateDate

The date the autopayment is set to trigger for this bill as indicated on the statement

Returns:

  • (Date)


39
40
41
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 39

def auto_pay_date
  @auto_pay_date
end

#auto_pay_enabledTrueClass | FalseClass

Whether the user's bill is paid automatically as indicated on the statement

Returns:

  • (TrueClass | FalseClass)


29
30
31
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 29

def auto_pay_enabled
  @auto_pay_enabled
end

#due_dateDate

The date that the payment is due as indicated on the statement

Returns:

  • (Date)


24
25
26
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 24

def due_date
  @due_date
end

#last_payment_amountFloat

The amount of the most recent payment as indicated on the statement

Returns:

  • (Float)


48
49
50
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 48

def last_payment_amount
  @last_payment_amount
end

#last_payment_dateDate

The date of most recent payment as indicated on the statement

Returns:

  • (Date)


52
53
54
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 52

def last_payment_date
  @last_payment_date
end

#minimum_payment_dueFloat

The minimum amount which is due on the account statement

Returns:

  • (Float)


20
21
22
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 20

def minimum_payment_due
  @minimum_payment_due
end

#past_due_amountFloat

The amount that the user should have already paid as it appears on the statement. The value is negative if the user owes money

Returns:

  • (Float)


44
45
46
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 44

def past_due_amount
  @past_due_amount
end

#statement_balanceFloat

The amount of the last statement. The value is negative if the user owes money

Returns:

  • (Float)


57
58
59
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 57

def statement_balance
  @statement_balance
end

#statement_dateDate

The date the statement was issued

Returns:

  • (Date)


61
62
63
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 61

def statement_date
  @statement_date
end

#total_payment_dueFloat

Total payment due or next payment due as it appears on the account statement. Monthly payment due for loans. May be the same amount as the statementBalance

Returns:

  • (Float)


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

def total_payment_due
  @total_payment_due
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 126

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total_payment_due =
    hash.key?('totalPaymentDue') ? hash['totalPaymentDue'] : SKIP
  minimum_payment_due =
    hash.key?('minimumPaymentDue') ? hash['minimumPaymentDue'] : SKIP
  due_date = hash.key?('dueDate') ? hash['dueDate'] : SKIP
  auto_pay_enabled =
    hash.key?('autoPayEnabled') ? hash['autoPayEnabled'] : SKIP
  auto_pay_amount =
    hash.key?('autoPayAmount') ? hash['autoPayAmount'] : SKIP
  auto_pay_date = hash.key?('autoPayDate') ? hash['autoPayDate'] : SKIP
  past_due_amount =
    hash.key?('pastDueAmount') ? hash['pastDueAmount'] : SKIP
  last_payment_amount =
    hash.key?('lastPaymentAmount') ? hash['lastPaymentAmount'] : SKIP
  last_payment_date =
    hash.key?('lastPaymentDate') ? hash['lastPaymentDate'] : SKIP
  statement_balance =
    hash.key?('statementBalance') ? hash['statementBalance'] : SKIP
  statement_date = hash.key?('statementDate') ? hash['statementDate'] : 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.
  BillEntity.new(total_payment_due: total_payment_due,
                 minimum_payment_due: minimum_payment_due,
                 due_date: due_date,
                 auto_pay_enabled: auto_pay_enabled,
                 auto_pay_amount: auto_pay_amount,
                 auto_pay_date: auto_pay_date,
                 past_due_amount: past_due_amount,
                 last_payment_amount: last_payment_amount,
                 last_payment_date: last_payment_date,
                 statement_balance: statement_balance,
                 statement_date: statement_date,
                 additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 64

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_payment_due'] = 'totalPaymentDue'
  @_hash['minimum_payment_due'] = 'minimumPaymentDue'
  @_hash['due_date'] = 'dueDate'
  @_hash['auto_pay_enabled'] = 'autoPayEnabled'
  @_hash['auto_pay_amount'] = 'autoPayAmount'
  @_hash['auto_pay_date'] = 'autoPayDate'
  @_hash['past_due_amount'] = 'pastDueAmount'
  @_hash['last_payment_amount'] = 'lastPaymentAmount'
  @_hash['last_payment_date'] = 'lastPaymentDate'
  @_hash['statement_balance'] = 'statementBalance'
  @_hash['statement_date'] = 'statementDate'
  @_hash
end

.nullablesObject

An array for nullable fields



98
99
100
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 98

def self.nullables
  []
end

.optionalsObject

An array for optional fields



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 81

def self.optionals
  %w[
    total_payment_due
    minimum_payment_due
    due_date
    auto_pay_enabled
    auto_pay_amount
    auto_pay_date
    past_due_amount
    last_payment_amount
    last_payment_date
    statement_balance
    statement_date
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (BillEntity | Hash)

    value against the validation is performed.



174
175
176
177
178
179
180
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 174

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.



194
195
196
197
198
199
200
201
202
203
204
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 194

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} total_payment_due: #{@total_payment_due.inspect}, minimum_payment_due:"\
  " #{@minimum_payment_due.inspect}, due_date: #{@due_date.inspect}, auto_pay_enabled:"\
  " #{@auto_pay_enabled.inspect}, auto_pay_amount: #{@auto_pay_amount.inspect}, auto_pay_date:"\
  " #{@auto_pay_date.inspect}, past_due_amount: #{@past_due_amount.inspect},"\
  " last_payment_amount: #{@last_payment_amount.inspect}, last_payment_date:"\
  " #{@last_payment_date.inspect}, statement_balance: #{@statement_balance.inspect},"\
  " statement_date: #{@statement_date.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



183
184
185
186
187
188
189
190
191
# File 'lib/fdx_v660_api/models/bill_entity.rb', line 183

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} total_payment_due: #{@total_payment_due}, minimum_payment_due:"\
  " #{@minimum_payment_due}, due_date: #{@due_date}, auto_pay_enabled: #{@auto_pay_enabled},"\
  " auto_pay_amount: #{@auto_pay_amount}, auto_pay_date: #{@auto_pay_date}, past_due_amount:"\
  " #{@past_due_amount}, last_payment_amount: #{@last_payment_amount}, last_payment_date:"\
  " #{@last_payment_date}, statement_balance: #{@statement_balance}, statement_date:"\
  " #{@statement_date}, additional_properties: #{@additional_properties}>"
end