module Bcoin::Client::HttpMethods

Public Instance Methods

base_path() click to toggle source

Override this in sub class

# File lib/bcoin/client/http_methods.rb, line 6
def base_path
  '/base'
end
delete(path, options = {}) click to toggle source
# File lib/bcoin/client/http_methods.rb, line 31
def delete path, options = {}
  options[:token] = wallet_token if wallet_token
  response = @client.delete base_path + path, options
  set_error_from response
  response
end
get(path, options = {}) click to toggle source
# File lib/bcoin/client/http_methods.rb, line 10
def get path, options = {}
  options[:token] = wallet_token if wallet_token
  response = @client.get base_path + path, options
  set_error_from response
  response
end
post(path, options = {}) click to toggle source
# File lib/bcoin/client/http_methods.rb, line 17
def post path, options = {}
  options[:token] = wallet_token if wallet_token
  response = @client.post base_path + path, options
  set_error_from response
  response
end
put(path, options = {}) click to toggle source
# File lib/bcoin/client/http_methods.rb, line 24
def put path, options = {}
  options[:token] = wallet_token if wallet_token
  response = @client.put base_path + path, options
  set_error_from response
  response
end
wallet_token() click to toggle source

Override this is sub class

# File lib/bcoin/client/http_methods.rb, line 39
def wallet_token
  nil
end

Private Instance Methods

set_error_from(response = {}) click to toggle source
# File lib/bcoin/client/http_methods.rb, line 45
def set_error_from response = {}
  if response.is_a?(Hash) &&  response['error']
    self.error = response['error']
  end
end