Class: Rbsx::Client
- Inherits:
-
Object
- Object
- Rbsx::Client
- Defined in:
- lib/rbsx/client.rb
Instance Method Summary collapse
- #bci_fetch_last_height ⇒ Object
- #generate_address(n) ⇒ Object
-
#initialize(config = {}) ⇒ Client
constructor
A new instance of Client.
- #sx(command) ⇒ Object
Constructor Details
#initialize(config = {}) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 |
# File 'lib/rbsx/client.rb', line 6 def initialize(config={}) Rbsx::CONFIG_ATTRS.each do |attr| self.send :"#{attr}=", config[attr] end end |
Instance Method Details
#bci_fetch_last_height ⇒ Object
12 13 14 |
# File 'lib/rbsx/client.rb', line 12 def bci_fetch_last_height sx("bci-fetch-last-height").to_i end |
#generate_address(n) ⇒ Object
16 17 18 |
# File 'lib/rbsx/client.rb', line 16 def generate_address(n) sx("echo #{master_public_key} | sx genaddr #{n}").chomp end |
#sx(command) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rbsx/client.rb', line 20 def sx(command) full_command = [sx_path, command].join(" ") `#{full_command}` rescue Errno::ENOENT fail( SxNotFound, [ "sx path `#{sx_path}` does not seem to exist.", "Please make sure that you can execute `#{full_command}`.", ].join(" ") ) end |