Class: Peatio::ManagementAPIV2::Client
Instance Attribute Summary
#action
Instance Method Summary
collapse
#build_path, #generate_jwt, #http_client, #keychain, #payload, #request
Constructor Details
#initialize ⇒ Client
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
24
25
26
27
28
|
# File 'app/services/peatio/management_api_v2/client.rb', line 24
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
18
19
20
21
22
|
# File 'app/services/peatio/management_api_v2/client.rb', line 18
def create_transfer(request_params={})
self.action = :write_transfers
params = request_params.slice(:key, :category, :description, :operations)
request(:post, "transfers/new", params, {})
end
|
#create_withdraw(request_params = {}) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'app/services/peatio/management_api_v2/client.rb', line 8
def create_withdraw(request_params = {})
self.action = :write_withdraws
jwt = payload(request_params.slice(:uid, :tid, :beneficiary_id, :currency, :amount, :action, :note))
.yield_self { |payload| generate_jwt(payload) }
.yield_self do |jwt|
Barong::ManagementAPIV2::Client.new.otp_sign(request_params.merge(jwt: jwt, user_uid: request_params[:uid]))
end
request(:post, 'withdraws/new', jwt, jwt: true)
end
|
#currency(request_params = {}) ⇒ Object
30
31
32
33
34
|
# File 'app/services/peatio/management_api_v2/client.rb', line 30
def currency(request_params={})
self.action = :read_currencies
params = request_params.slice(:code)
request(:post, "/currencies/#{params[:code]}", {})
end
|
#update_currency(request_params = {}) ⇒ Object
42
43
44
45
46
|
# File 'app/services/peatio/management_api_v2/client.rb', line 42
def update_currency(request_params={})
self.action = :write_currencies
params = request_params.slice(:id, :state)
request(:put, "/currencies/update", params)
end
|
#update_market(request_params = {}) ⇒ Object
36
37
38
39
40
|
# File 'app/services/peatio/management_api_v2/client.rb', line 36
def update_market(request_params={})
self.action = :write_markets
params = request_params.slice(:id, :state)
request(:put, "/markets/update", params)
end
|