class Blockchain::API::V2::Client

Public Class Methods

new(options = {}) click to toggle source
# File lib/blockchain/api/v2/client.rb, line 9
def initialize(options = {})
  @options = options

  %i(xpub key).each do |key|
    raise ArgumentError.new("No :#{ key } given!") unless @options[key]
  end
end

Public Instance Methods

check_gap(query = {})
Alias for: checkgap
check_gap!(query = {})
Alias for: checkgap!
checkgap(query = {}) click to toggle source
# File lib/blockchain/api/v2/client.rb, line 25
def checkgap(query = {})
  query.merge!(@options)
  self.class.get('/receive/checkgap', query: query).parsed_response
end
Also aliased as: check_gap
checkgap!(query = {}) click to toggle source

Returns an explicit Integer, just for convenience

# File lib/blockchain/api/v2/client.rb, line 34
def checkgap!(query = {})
  checkgap(query)['gap']
end
Also aliased as: check_gap!, gap
gap(query = {})
Alias for: checkgap!
receive(query = {}) click to toggle source
# File lib/blockchain/api/v2/client.rb, line 17
def receive(query = {})
  query.merge!(@options)
  raise ArgumentError.new(":callback is mandatory!") unless query[:callback]
  raise ArgumentError.new(":index and :gap are mutually exclusive (remove one of them)!") if query[:index] && query[:gap]

  self.class.get('/receive', query: query).parsed_response
end