lib/coinsetter.rb in coinsetter-0.0.4 vs lib/coinsetter.rb in coinsetter-0.0.5
- old
+ new
@@ -41,24 +41,40 @@
def self.with_session
if client_session.kind_of? ClientSession
yield client_session if block_given?
destroy_client_session!
else
- client_session
+ {error: 'No Client Session available.'}
end
end
def self.client_session
@client_session ||= ClientSessions.new.create(credentials)
end
+ def self.get_account(account_uuid)
+ Customer::Accounts.new(client_session.uuid).get(account_uuid)
+ end
+
def self.destroy_client_session!
client_session.destroy!
@client_session = nil
end
- def self.orders
- @@orders ||= Orders.new
+ def self.orders(uuid=nil)
+ Orders.new(uuid)
+ end
+
+ def self.accounts(uuid=nil)
+ Customer::Accounts.new(uuid)
+ end
+
+ def self.list_orders(account_id, view="OPEN")
+ orders.list("customer/account/#{account_id}/order", view: view)
+ end
+
+ def self.list_accounts
+ accounts.list
end
def self.add_order(side='BUY', options={})
with_session do |client_session|
params = default_options.merge(options)