class BlueBank::AccountList

Attributes

client[R]
customer[R]

Public Class Methods

new(customer:, client:) click to toggle source
# File lib/blue_bank/account_list.rb, line 5
def initialize(customer:, client:)
  @customer, @client = customer, client
end

Public Instance Methods

each(&block) click to toggle source
# File lib/blue_bank/account_list.rb, line 9
def each(&block)
  account_objects.each(&block)
end

Private Instance Methods

account_objects() click to toggle source
# File lib/blue_bank/account_list.rb, line 15
def account_objects
  json.map { |account_json|
    Account.new(id: account_json.fetch("id"), json: account_json, client: client)
  }
end
json() click to toggle source
# File lib/blue_bank/account_list.rb, line 21
def json
  @json ||= client.get("/customers/#{customer.id}/accounts")
end