Class: XeroRuby::Finance::StatementLinesResponse
- Inherits:
-
Object
- Object
- XeroRuby::Finance::StatementLinesResponse
- Defined in:
- lib/xero-ruby/models/finance/statement_lines_response.rb
Instance Attribute Summary collapse
-
#avg_days_unreconciled_neg ⇒ Object
Sum-product of age of statement line in days multiplied by transaction amount, divided by the sum of transaction amount - in for those statement lines in which the reconciled flag is set to FALSE, and the amount is negative.
-
#avg_days_unreconciled_pos ⇒ Object
Sum-product of age of statement line in days multiplied by transaction amount, divided by the sum of transaction amount - in for those statement lines in which the reconciled flag is set to FALSE, and the amount is positive.
-
#data_source ⇒ Object
Returns the value of attribute data_source.
-
#deleted_amount ⇒ Object
Sum of the amounts of all deleted statement lines.
-
#earliest_reconciled_transaction ⇒ Object
UTC Date which is the earliest transaction date of a statement line for which the reconciled flag is set to TRUE.
-
#earliest_unreconciled_transaction ⇒ Object
UTC Date which is the earliest transaction date of a statement line for which the reconciled flag is set to FALSE.
-
#latest_reconciled_transaction ⇒ Object
UTC Date which is the latest transaction date of a statement line for which the reconciled flag is set to TRUE.
-
#latest_unreconciled_transaction ⇒ Object
UTC Date which is the latest transaction date of a statement line for which the reconciled flag is set to FALSE.
-
#reconciled_amount_neg ⇒ Object
Sum of the amounts of all statement lines where both the reconciled flag is set to TRUE, and the amount is negative.
-
#reconciled_amount_pos ⇒ Object
Sum of the amounts of all statement lines where both the reconciled flag is set to TRUE, and the amount is positive.
-
#reconciled_lines ⇒ Object
Count of all statement lines where the reconciled flag is set to TRUE.
-
#total_amount ⇒ Object
Sum of the amounts of all statement lines.
-
#total_amount_neg ⇒ Object
Sum of the amounts of all statement lines where the amount is negative.
-
#total_amount_pos ⇒ Object
Sum of the amounts of all statement lines where the amount is positive.
-
#unreconciled_amount_neg ⇒ Object
Sum of the amounts of all statement lines where both the reconciled flag is set to FALSE, and the amount is negative.
-
#unreconciled_amount_pos ⇒ Object
Sum of the amounts of all statement lines where both the reconciled flag is set to FALSE, and the amount is positive.
-
#unreconciled_lines ⇒ Object
Count of all statement lines where the reconciled flag is set to FALSE.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value, downcase: false) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ StatementLinesResponse
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
- #parse_date(datestring) ⇒ Object
-
#to_attributes ⇒ Object
Returns the object in the form of hash with snake_case.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash(downcase: false) ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ StatementLinesResponse
Initializes the object
118 119 120 121 122 123 124 125 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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 118 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `XeroRuby::Finance::StatementLinesResponse` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| if (!self.class.attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `XeroRuby::Finance::StatementLinesResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'unreconciled_amount_pos') self.unreconciled_amount_pos = attributes[:'unreconciled_amount_pos'] end if attributes.key?(:'unreconciled_amount_neg') self.unreconciled_amount_neg = attributes[:'unreconciled_amount_neg'] end if attributes.key?(:'unreconciled_lines') self.unreconciled_lines = attributes[:'unreconciled_lines'] end if attributes.key?(:'avg_days_unreconciled_pos') self.avg_days_unreconciled_pos = attributes[:'avg_days_unreconciled_pos'] end if attributes.key?(:'avg_days_unreconciled_neg') self.avg_days_unreconciled_neg = attributes[:'avg_days_unreconciled_neg'] end if attributes.key?(:'earliest_unreconciled_transaction') self.earliest_unreconciled_transaction = attributes[:'earliest_unreconciled_transaction'] end if attributes.key?(:'latest_unreconciled_transaction') self.latest_unreconciled_transaction = attributes[:'latest_unreconciled_transaction'] end if attributes.key?(:'deleted_amount') self.deleted_amount = attributes[:'deleted_amount'] end if attributes.key?(:'total_amount') self.total_amount = attributes[:'total_amount'] end if attributes.key?(:'data_source') self.data_source = attributes[:'data_source'] end if attributes.key?(:'earliest_reconciled_transaction') self.earliest_reconciled_transaction = attributes[:'earliest_reconciled_transaction'] end if attributes.key?(:'latest_reconciled_transaction') self.latest_reconciled_transaction = attributes[:'latest_reconciled_transaction'] end if attributes.key?(:'reconciled_amount_pos') self.reconciled_amount_pos = attributes[:'reconciled_amount_pos'] end if attributes.key?(:'reconciled_amount_neg') self.reconciled_amount_neg = attributes[:'reconciled_amount_neg'] end if attributes.key?(:'reconciled_lines') self.reconciled_lines = attributes[:'reconciled_lines'] end if attributes.key?(:'total_amount_pos') self.total_amount_pos = attributes[:'total_amount_pos'] end if attributes.key?(:'total_amount_neg') self.total_amount_neg = attributes[:'total_amount_neg'] end end |
Instance Attribute Details
#avg_days_unreconciled_neg ⇒ Object
Sum-product of age of statement line in days multiplied by transaction amount, divided by the sum of transaction amount - in for those statement lines in which the reconciled flag is set to FALSE, and the amount is negative. Provides an indication of the age of unreconciled transactions.
32 33 34 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 32 def avg_days_unreconciled_neg @avg_days_unreconciled_neg end |
#avg_days_unreconciled_pos ⇒ Object
Sum-product of age of statement line in days multiplied by transaction amount, divided by the sum of transaction amount - in for those statement lines in which the reconciled flag is set to FALSE, and the amount is positive. Provides an indication of the age of unreconciled transactions.
29 30 31 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 29 def avg_days_unreconciled_pos @avg_days_unreconciled_pos end |
#data_source ⇒ Object
Returns the value of attribute data_source.
47 48 49 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 47 def data_source @data_source end |
#deleted_amount ⇒ Object
Sum of the amounts of all deleted statement lines. Transactions may be deleted due to duplication or otherwise.
41 42 43 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 41 def deleted_amount @deleted_amount end |
#earliest_reconciled_transaction ⇒ Object
UTC Date which is the earliest transaction date of a statement line for which the reconciled flag is set to TRUE. This date is represented in ISO 8601 format.
50 51 52 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 50 def earliest_reconciled_transaction @earliest_reconciled_transaction end |
#earliest_unreconciled_transaction ⇒ Object
UTC Date which is the earliest transaction date of a statement line for which the reconciled flag is set to FALSE. This date is represented in ISO 8601 format.
35 36 37 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 35 def earliest_unreconciled_transaction @earliest_unreconciled_transaction end |
#latest_reconciled_transaction ⇒ Object
UTC Date which is the latest transaction date of a statement line for which the reconciled flag is set to TRUE. This date is represented in ISO 8601 format.
53 54 55 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 53 def latest_reconciled_transaction @latest_reconciled_transaction end |
#latest_unreconciled_transaction ⇒ Object
UTC Date which is the latest transaction date of a statement line for which the reconciled flag is set to FALSE. This date is represented in ISO 8601 format.
38 39 40 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 38 def latest_unreconciled_transaction @latest_unreconciled_transaction end |
#reconciled_amount_neg ⇒ Object
Sum of the amounts of all statement lines where both the reconciled flag is set to TRUE, and the amount is negative.
59 60 61 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 59 def reconciled_amount_neg @reconciled_amount_neg end |
#reconciled_amount_pos ⇒ Object
Sum of the amounts of all statement lines where both the reconciled flag is set to TRUE, and the amount is positive.
56 57 58 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 56 def reconciled_amount_pos @reconciled_amount_pos end |
#reconciled_lines ⇒ Object
Count of all statement lines where the reconciled flag is set to TRUE
62 63 64 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 62 def reconciled_lines @reconciled_lines end |
#total_amount ⇒ Object
Sum of the amounts of all statement lines. This is used as a metric of comparison to the unreconciled figures above.
44 45 46 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 44 def total_amount @total_amount end |
#total_amount_neg ⇒ Object
Sum of the amounts of all statement lines where the amount is negative.
68 69 70 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 68 def total_amount_neg @total_amount_neg end |
#total_amount_pos ⇒ Object
Sum of the amounts of all statement lines where the amount is positive
65 66 67 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 65 def total_amount_pos @total_amount_pos end |
#unreconciled_amount_neg ⇒ Object
Sum of the amounts of all statement lines where both the reconciled flag is set to FALSE, and the amount is negative.
23 24 25 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 23 def unreconciled_amount_neg @unreconciled_amount_neg end |
#unreconciled_amount_pos ⇒ Object
Sum of the amounts of all statement lines where both the reconciled flag is set to FALSE, and the amount is positive.
20 21 22 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 20 def unreconciled_amount_pos @unreconciled_amount_pos end |
#unreconciled_lines ⇒ Object
Count of all statement lines where the reconciled flag is set to FALSE.
26 27 28 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 26 def unreconciled_lines @unreconciled_lines end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 71 def self.attribute_map { :'unreconciled_amount_pos' => :'unreconciledAmountPos', :'unreconciled_amount_neg' => :'unreconciledAmountNeg', :'unreconciled_lines' => :'unreconciledLines', :'avg_days_unreconciled_pos' => :'avgDaysUnreconciledPos', :'avg_days_unreconciled_neg' => :'avgDaysUnreconciledNeg', :'earliest_unreconciled_transaction' => :'earliestUnreconciledTransaction', :'latest_unreconciled_transaction' => :'latestUnreconciledTransaction', :'deleted_amount' => :'deletedAmount', :'total_amount' => :'totalAmount', :'data_source' => :'dataSource', :'earliest_reconciled_transaction' => :'earliestReconciledTransaction', :'latest_reconciled_transaction' => :'latestReconciledTransaction', :'reconciled_amount_pos' => :'reconciledAmountPos', :'reconciled_amount_neg' => :'reconciledAmountNeg', :'reconciled_lines' => :'reconciledLines', :'total_amount_pos' => :'totalAmountPos', :'total_amount_neg' => :'totalAmountNeg' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
252 253 254 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 252 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_types ⇒ Object
Attribute type mapping.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 94 def self.openapi_types { :'unreconciled_amount_pos' => :'BigDecimal', :'unreconciled_amount_neg' => :'BigDecimal', :'unreconciled_lines' => :'Integer', :'avg_days_unreconciled_pos' => :'BigDecimal', :'avg_days_unreconciled_neg' => :'BigDecimal', :'earliest_unreconciled_transaction' => :'Date', :'latest_unreconciled_transaction' => :'Date', :'deleted_amount' => :'BigDecimal', :'total_amount' => :'BigDecimal', :'data_source' => :'DataSourceResponse', :'earliest_reconciled_transaction' => :'Date', :'latest_reconciled_transaction' => :'Date', :'reconciled_amount_pos' => :'BigDecimal', :'reconciled_amount_neg' => :'BigDecimal', :'reconciled_lines' => :'Integer', :'total_amount_pos' => :'BigDecimal', :'total_amount_neg' => :'BigDecimal' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 215 def ==(o) return true if self.equal?(o) self.class == o.class && unreconciled_amount_pos == o.unreconciled_amount_pos && unreconciled_amount_neg == o.unreconciled_amount_neg && unreconciled_lines == o.unreconciled_lines && avg_days_unreconciled_pos == o.avg_days_unreconciled_pos && avg_days_unreconciled_neg == o.avg_days_unreconciled_neg && earliest_unreconciled_transaction == o.earliest_unreconciled_transaction && latest_unreconciled_transaction == o.latest_unreconciled_transaction && deleted_amount == o.deleted_amount && total_amount == o.total_amount && data_source == o.data_source && earliest_reconciled_transaction == o.earliest_reconciled_transaction && latest_reconciled_transaction == o.latest_reconciled_transaction && reconciled_amount_pos == o.reconciled_amount_pos && reconciled_amount_neg == o.reconciled_amount_neg && reconciled_lines == o.reconciled_lines && total_amount_pos == o.total_amount_pos && total_amount_neg == o.total_amount_neg end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 280 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(parse_date(value)) when :Date Date.parse(parse_date(value)) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BigDecimal BigDecimal(value.to_s) when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model XeroRuby::Finance.const_get(type).build_from_hash(value) end end |
#_to_hash(value, downcase: false) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 353 def _to_hash(value, downcase: false) if value.is_a?(Array) value.map do |v| v.to_hash(downcase: downcase) end elsif value.is_a?(Hash) {}.tap do |hash| value.map { |k, v| hash[k] = _to_hash(v, downcase: downcase) } end elsif value.respond_to? :to_hash value.to_hash(downcase: downcase) else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 259 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
239 240 241 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 239 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
245 246 247 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 245 def hash [unreconciled_amount_pos, unreconciled_amount_neg, unreconciled_lines, avg_days_unreconciled_pos, avg_days_unreconciled_neg, earliest_unreconciled_transaction, latest_unreconciled_transaction, deleted_amount, total_amount, data_source, earliest_reconciled_transaction, latest_reconciled_transaction, reconciled_amount_pos, reconciled_amount_neg, reconciled_lines, total_amount_pos, total_amount_neg].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
202 203 204 205 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 202 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#parse_date(datestring) ⇒ Object
369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 369 def parse_date(datestring) if datestring.include?('Date') date_pattern = /\/Date\((-?\d+)(\+\d+)?\)\// original, date, timezone = *date_pattern.match(datestring) date = (date.to_i / 1000) Time.at(date).utc.strftime('%Y-%m-%dT%H:%M:%S%z').to_s elsif /(\d\d\d\d)-(\d\d)/.match(datestring) # handles dates w/out Days: YYYY-MM*-DD Time.parse(datestring + '-01').strftime('%Y-%m-%dT%H:%M:%S').to_s else # handle date 'types' for small subset of payroll API's Time.parse(datestring).strftime('%Y-%m-%dT%H:%M:%S').to_s end end |
#to_attributes ⇒ Object
Returns the object in the form of hash with snake_case
345 346 347 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 345 def to_attributes to_hash(downcase: true) end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
327 328 329 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 327 def to_body to_hash end |
#to_hash(downcase: false) ⇒ Hash
Returns the object in the form of hash
333 334 335 336 337 338 339 340 341 342 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 333 def to_hash(downcase: false) hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? key = downcase ? attr : param hash[key] = _to_hash(value, downcase: downcase) end hash end |
#to_s ⇒ String
Returns the string representation of the object
321 322 323 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 321 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
209 210 211 |
# File 'lib/xero-ruby/models/finance/statement_lines_response.rb', line 209 def valid? true end |