Module: Cryptoprocessing::Client::Callbacks

Included in:
Cryptoprocessing::Client
Defined in:
lib/cryptoprocessing/client/callbacks.rb

Instance Method Summary collapse

Instance Method Details

#callbacks(account_id, options = {}) ⇒ Array<Cryptoprocessing::Callback>

Callback list



11
12
13
14
15
16
17
18
19
# File 'lib/cryptoprocessing/client/callbacks.rb', line 11

def callbacks(, options = {})
  out = nil
  currency = if options[:currency] then options[:currency] else blockchain_type end
  get("/v1/#{currency}/accounts/#{account_id}/callback", options) do |resp|
    out = resp.data['addresses'].map { |item| Cryptoprocessing::Callback.new(self, item) }
    yield(out, resp) if block_given?
  end
  out
end

#create_callback(account_id, address, options = {}) ⇒ Cryptoprocessing::Callback

Create callback



27
28
29
30
31
32
33
34
35
36
# File 'lib/cryptoprocessing/client/callbacks.rb', line 27

def create_callback(, address, options = {})
  out = nil
  currency = if options[:currency] then options[:currency] else blockchain_type end
  options[:address] = address
  post("/v1/#{currency}/accounts/#{account_id}/callback", options) do |resp|
    out = Cryptoprocessing::Callback.new(self, resp.body.merge(options))
    yield(out, resp) if block_given?
  end
  out
end