Class: EwayRapid::InternalModels::BalancePerCardType

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

#balanceObject

Returns the value of attribute balance.



492
493
494
# File 'lib/eway_rapid/models/internal_models.rb', line 492

def balance
  @balance
end

#card_typeObject

Returns the value of attribute card_type.



488
489
490
# File 'lib/eway_rapid/models/internal_models.rb', line 488

def card_type
  @card_type
end

#creditObject

Returns the value of attribute credit.



490
491
492
# File 'lib/eway_rapid/models/internal_models.rb', line 490

def credit
  @credit
end

#debitObject

Returns the value of attribute debit.



491
492
493
# File 'lib/eway_rapid/models/internal_models.rb', line 491

def debit
  @debit
end

#number_of_transactionsObject

Returns the value of attribute number_of_transactions.



489
490
491
# File 'lib/eway_rapid/models/internal_models.rb', line 489

def number_of_transactions
  @number_of_transactions
end

Class Method Details

.from_array(array) ⇒ Object



509
510
511
512
513
514
515
516
# File 'lib/eway_rapid/models/internal_models.rb', line 509

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

.from_hash(hash) ⇒ Object



499
500
501
502
503
504
505
506
507
# File 'lib/eway_rapid/models/internal_models.rb', line 499

def self.from_hash(hash)
  balance = BalancePerCardType.new
  balance.card_type = hash[Constants::CARD_TYPE]
  balance.number_of_transactions = hash[Constants::NUMBER_OF_TRANSACTIONS]
  balance.credit = hash[Constants::CREDIT]
  balance.debit = hash[Constants::DEBIT]
  balance.balance = hash[Constants::BALANCE]
  balance
end

.from_json(json) ⇒ Object



494
495
496
497
# File 'lib/eway_rapid/models/internal_models.rb', line 494

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