Class: EwayRapid::InternalModels::SettlementSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/eway_rapid/models/internal_models.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#balance_per_card_typeObject

Returns the value of attribute balance_per_card_type.



438
439
440
# File 'lib/eway_rapid/models/internal_models.rb', line 438

def balance_per_card_type
  @balance_per_card_type
end

#currencyObject

Returns the value of attribute currency.



433
434
435
# File 'lib/eway_rapid/models/internal_models.rb', line 433

def currency
  @currency
end

#currency_codeObject

Returns the value of attribute currency_code.



434
435
436
# File 'lib/eway_rapid/models/internal_models.rb', line 434

def currency_code
  @currency_code
end

#settlement_idObject

Returns the value of attribute settlement_id.



432
433
434
# File 'lib/eway_rapid/models/internal_models.rb', line 432

def settlement_id
  @settlement_id
end

#total_balanceObject

Returns the value of attribute total_balance.



437
438
439
# File 'lib/eway_rapid/models/internal_models.rb', line 437

def total_balance
  @total_balance
end

#total_creditObject

Returns the value of attribute total_credit.



435
436
437
# File 'lib/eway_rapid/models/internal_models.rb', line 435

def total_credit
  @total_credit
end

#total_debitObject

Returns the value of attribute total_debit.



436
437
438
# File 'lib/eway_rapid/models/internal_models.rb', line 436

def total_debit
  @total_debit
end

Class Method Details

.from_array(array) ⇒ Object



457
458
459
460
461
462
463
464
# File 'lib/eway_rapid/models/internal_models.rb', line 457

def self.from_array(array)
  summaries = []
  Array(array).each {|summary_hash|
    obj = from_hash(summary_hash)
    summaries.push(obj)
  }
  summaries
end

.from_hash(hash) ⇒ Object



445
446
447
448
449
450
451
452
453
454
455
# File 'lib/eway_rapid/models/internal_models.rb', line 445

def self.from_hash(hash)
  settlement_summary = SettlementSummary.new
  settlement_summary.settlement_id = hash[Constants::SETTLEMENT_ID]
  settlement_summary.currency = hash[Constants::CURRENCY]
  settlement_summary.currency_code = hash[Constants::CURRENCY_CODE]
  settlement_summary.total_credit = hash[Constants::TOTAL_CREDIT]
  settlement_summary.total_debit = hash[Constants::TOTAL_DEBIT]
  settlement_summary.total_balance = hash[Constants::TOTAL_BALANCE]
  settlement_summary.balance_per_card_type = BalancePerCardType.from_array(hash[Constants::BALANCE_PER_CARD_TYPE])
  settlement_summary
end

.from_json(json) ⇒ Object



440
441
442
443
# File 'lib/eway_rapid/models/internal_models.rb', line 440

def self.from_json(json)
  hash = JSON.parse(json)
  from_hash(hash)
end