class Bcoin::Client::Base
Attributes
attributes[R]
client[R]
Public Class Methods
new(client, attr = {})
click to toggle source
# File lib/bcoin/client/base.rb, line 9 def initialize client, attr = {} @client = client self.attributes = attr end
Public Instance Methods
attributes=(attr)
click to toggle source
# File lib/bcoin/client/base.rb, line 41 def attributes= attr @attributes = symbolize attr end
base_path()
click to toggle source
Override this in sub class
# File lib/bcoin/client/base.rb, line 24 def base_path '/base' end
error()
click to toggle source
# File lib/bcoin/client/base.rb, line 45 def error @attributes[:error] end
error=(_error)
click to toggle source
# File lib/bcoin/client/base.rb, line 49 def error= _error @attributes[:error] = _error end
id()
click to toggle source
Override this in sub class
# File lib/bcoin/client/base.rb, line 19 def id 'base' end
inspect()
click to toggle source
# File lib/bcoin/client/base.rb, line 14 def inspect printf "#<%s @attributes=%p>", self.class.name, @attributes end
refresh!()
click to toggle source
# File lib/bcoin/client/base.rb, line 28 def refresh! self.attributes = get '/' self end
respond_to?(method, include_all = false)
click to toggle source
Calls superclass method
# File lib/bcoin/client/base.rb, line 53 def respond_to? method, include_all = false @attributes[method] ? true : super end
token=(_token)
click to toggle source
# File lib/bcoin/client/base.rb, line 37 def token= _token @attributes[:token] = _token end
wallet_token()
click to toggle source
# File lib/bcoin/client/base.rb, line 33 def wallet_token @attributes[:token] if @attributes end
Private Instance Methods
method_missing(method, *args)
click to toggle source
# File lib/bcoin/client/base.rb, line 67 def method_missing method, *args if @attributes[method].nil? raise NoMethodError else @attributes[method] end end
symbolize(attr)
click to toggle source
# File lib/bcoin/client/base.rb, line 59 def symbolize attr symbolized = {} attr.each do |k,v| symbolized[k.to_sym] = v end symbolized end