28 lines
486 B
Ruby
28 lines
486 B
Ruby
# frozen_string_literal: true
|
|
|
|
module StrikeMe
|
|
module API
|
|
class Account
|
|
class Balances
|
|
include Enumerable
|
|
|
|
attr_reader :account
|
|
|
|
def initialize(account, items)
|
|
@account = account
|
|
# Map hash to object
|
|
@items = items.map { |item| Balance.new item }
|
|
end
|
|
|
|
def each(&block)
|
|
@items.each(&block)
|
|
end
|
|
|
|
def to_a
|
|
@items.map(&:attributes)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|