class Quovo::Api::Accounts

Public Instance Methods

all() click to toggle source
# File lib/quovo/api/accounts.rb, line 8
def all
  api(:get, '/accounts')
    .fetch('accounts')
    .cast(Account)
end
create(params) click to toggle source
# File lib/quovo/api/accounts.rb, line 21
def create(params)
  params.require!(:user, :brokerage, :username, :password)
  api(:post, '/accounts', params)
    .fetch('account')
    .cast(Account)
end
delete(id) click to toggle source
# File lib/quovo/api/accounts.rb, line 38
def delete(id)
  id.require!(as: :id)
  api(:delete, "/accounts/#{id}")
end
find(id) click to toggle source
# File lib/quovo/api/accounts.rb, line 14
def find(id)
  id.require!(as: :id)
  api(:get, "/accounts/#{id}")
    .fetch('account')
    .cast(Account)
end
for_user(id) click to toggle source
# File lib/quovo/api/accounts.rb, line 43
def for_user(id)
  id.require!(as: :id)
  api(:get, "/users/#{id}/accounts")
    .fetch('accounts')
    .cast(Account)
end
sync(id) click to toggle source
# File lib/quovo/api/accounts.rb, line 57
def sync(id)
  id.require!(as: :id)
  api(:get, "/accounts/#{id}/sync")
    .fetch('sync')
    .cast(Sync)
end
sync!(id) click to toggle source
# File lib/quovo/api/accounts.rb, line 50
def sync!(id)
  id.require!(as: :id)
  api(:post, "/accounts/#{id}/sync")
    .fetch('sync')
    .cast(Sync)
end
update(id, params) click to toggle source
# File lib/quovo/api/accounts.rb, line 28
def update(id, params)
  id.require!(as: :id)
  params
    .permit!(:brokerage, :username, :password)
  params.require!(:username, :password) if params[:username] || params[:password]
  api(:put, "/accounts/#{id}", params)
    .fetch('account')
    .cast(Account)
end