module Subledger::Store::Api::FirstAndLastLine

Public Instance Methods

first_and_last_line(args) click to toggle source
# File lib/subledger/store/api/roles/first_and_last_line.rb, line 6
def first_and_last_line args
  anchor = args[:account]
  client = anchor.client

  path = Path.for_entity( :anchor => anchor ) + '/first_and_last_line'

  klass = anchor.class

  begin
    collection = parse_json http.get( path ).body
  rescue Exception => e
    raise FirstAndLastLineError, "Cannot get first and last line: #{e}"
  end

  key = collection.keys.first

  collection[key].collect do |response_hash|
    args = Rest.to_args response_hash, client

    client.send key, args
  end
end