Sha256: f1e85a4e852a48e61b233c5837681d2ae5c734f080f63ffbe5b05b8a6e4bbb22
Contents?: true
Size: 764 Bytes
Versions: 8
Compression:
Stored size: 764 Bytes
Contents
module PensioAPI module Mixins module HasTransactions def self.included(base) base.send(:include, Enumerable) base.send(:attr_reader, :transactions) end def each @transactions.each { |t| yield t } end def last @transactions.last end private def map_transactions @transactions = if raw_transactions.is_a?(Array) raw_transactions.map { |t| PensioAPI::Transaction.new(t) } else [PensioAPI::Transaction.new(raw_transactions)] end end def raw_transactions @raw_transactions ||= if @raw['Transactions'] @raw['Transactions']['Transaction'] else [] end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems