Class: Peatio::ManagementAPIV2::Client

Inherits:
ManagementAPIV2::Client show all
Defined in:
app/services/peatio/management_api_v2/client.rb

Instance Attribute Summary

Attributes inherited from ManagementAPIV2::Client

#action

Instance Method Summary collapse

Methods inherited from ManagementAPIV2::Client

#build_path, #generate_jwt, #http_client, #keychain, #payload, #request

Constructor Details

#initializeClient

Returns a new instance of Client.



4
5
6
# File 'app/services/peatio/management_api_v2/client.rb', line 4

def initialize(*)
  super ENV.fetch('PEATIO_URL'), Rails.configuration.x.peatio_management_api_v2_configuration
end

Instance Method Details

#balance(request_params = {}) ⇒ Object



14
15
16
17
18
# File 'app/services/peatio/management_api_v2/client.rb', line 14

def balance(request_params={})
  self.action = :read_accounts
  params = request_params.slice(:uid, :currency)
  request(:post, "/accounts/balance", params, {})
end

#create_transfer(request_params = {}) ⇒ Object



8
9
10
11
12
# File 'app/services/peatio/management_api_v2/client.rb', line 8

def create_transfer(request_params={})
  self.action = :write_transfers
  params = request_params.slice(:key, :category, :description, :operations)
  request(:post, "transfers/new", params, {})
end

#currency(request_params = {}) ⇒ Object



20
21
22
23
24
# File 'app/services/peatio/management_api_v2/client.rb', line 20

def currency(request_params={})
  self.action = :read_currencies
  params = request_params.slice(:code)
  request(:post, "/currencies/#{params[:code]}", {})
end