Class: QuidaxDeposits

Inherits:
QuidaxBaseObject show all
Defined in:
lib/quidax/objects/deposits.rb

Overview

Deposit Object

Instance Attribute Summary

Attributes inherited from QuidaxBaseObject

#quidax

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from QuidaxBaseObject

get_request, #initialize, post_request, put_request, url

Constructor Details

This class inherits a constructor from QuidaxBaseObject

Class Method Details

.by_sub_users(q_object:) ⇒ Object



35
36
37
38
39
# File 'lib/quidax/objects/deposits.rb', line 35

def self.by_sub_users(q_object:)
  path = "#{API::USER_PATH}#{API::DEPOSIT_PATH}/all"

  get_request(q_object, path)
end

.by_user(q_object:, user_id:, query:) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/quidax/objects/deposits.rb', line 17

def self.by_user(q_object:, user_id:, query:)
  query.stringify_keys!

  Utils.check_missing_keys(required_keys: %w[currency state], keys: query.keys, field: "query")
  allowed_states = %w[submitting canceled submitted rejected failed accepted checked]
  Utils.validate_value_in_array(array: allowed_states, value: query["state"], field: "state")

  path = "#{API::USER_PATH}/#{user_id}/#{API::DEPOSIT_PATH}"

  get_request(q_object, path, query)
end

.get_a_deposit(q_object:, user_id:, deposit_id:) ⇒ Object



29
30
31
32
33
# File 'lib/quidax/objects/deposits.rb', line 29

def self.get_a_deposit(q_object:, user_id:, deposit_id:)
  path = "#{API::USER_PATH}/#{user_id}#{API::DEPOSIT_PATH}/#{deposit_id}"

  get_request(q_object, path)
end

Instance Method Details

#by_sub_usersObject



13
14
15
# File 'lib/quidax/objects/deposits.rb', line 13

def by_sub_users
  QuidaxDeposits.by_sub_users(q_object: @quidax)
end

#by_user(user_id:, query:) ⇒ Object



5
6
7
# File 'lib/quidax/objects/deposits.rb', line 5

def by_user(user_id:, query:)
  QuidaxDeposits.by_user(q_object: @quidax, user_id: user_id, query: query)
end

#get_a_deposit(user_id:, deposit_id:) ⇒ Object



9
10
11
# File 'lib/quidax/objects/deposits.rb', line 9

def get_a_deposit(user_id:, deposit_id:)
  QuidaxDeposits.get_a_deposit(q_object: @quidax, user_id: user_id, deposit_id: deposit_id)
end