class Bcoin::Client
Constants
- VERSION
Attributes
options[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/bcoin/client.rb, line 21 def initialize(options = {}) @options = options end
Public Instance Methods
base_uri()
click to toggle source
# File lib/bcoin/client.rb, line 41 def base_uri [host, port].join(':') end
basic_auth()
click to toggle source
# File lib/bcoin/client.rb, line 45 def basic_auth password.nil? ? nil : {username: username, password: password} end
default_options()
click to toggle source
# File lib/bcoin/client.rb, line 49 def default_options { base_uri: base_uri, basic_auth: basic_auth } end
delete(path, options = {})
click to toggle source
# File lib/bcoin/client.rb, line 73 def delete path, options = {} request :delete, path, body: options.to_json end
fee(blocks = 1)
click to toggle source
Check the current rate for processing a transaction within x number of blocks. @params [Integer] Blocks Number of blocks the transaction
will be processed within if paying the returned rate.
@return [Float] Rate
# File lib/bcoin/client.rb, line 86 def fee blocks = 1 response = get '/fee', blocks: blocks response['rate'] end
get(path, options = {})
click to toggle source
# File lib/bcoin/client.rb, line 61 def get path, options = {} request :get, path, query: options end
host()
click to toggle source
# File lib/bcoin/client.rb, line 29 def host @options[:host] || "localhost" end
password()
click to toggle source
# File lib/bcoin/client.rb, line 37 def password @options[:password] end
port()
click to toggle source
# File lib/bcoin/client.rb, line 25 def port @options[:port] || 8332 end
post(path, options = {})
click to toggle source
# File lib/bcoin/client.rb, line 65 def post path, options = {} request :post, path, body: options.to_json end
put(path, options = {})
click to toggle source
# File lib/bcoin/client.rb, line 69 def put path, options = {} request :put, path, body: options.to_json end
request(method, path, options = {})
click to toggle source
# File lib/bcoin/client.rb, line 56 def request method, path, options = {} options.merge! default_options self.class.send(method, path, options).parsed_response end
username()
click to toggle source
# File lib/bcoin/client.rb, line 33 def username @options[:username] end
wallets()
click to toggle source
# File lib/bcoin/client.rb, line 77 def wallets @wallets ||= Wallets.new(self) end