nis-ruby

Ruby client library for the NEM Infrastructure Server API
Installation
$ gem install nis-ruby
Or add this line to your application's Gemfile:
gem 'nis-ruby'
Usage
nis = Nis.new
nis.heartbeat
# => {code: 1, type: 2, message: "ok"}
# See http://bob.nem.ninja/docs/#heart-beat-request
nis.status
# => {code: 6, type: 4, message: "status"}
# See http://bob.nem.ninja/docs/#status-request
nis.request(:get, '/account/get',
address: 'TALICELCD3XPH4FFI5STGGNSNSWPOTG5E4DS2TOS'
)
# => [AccountMetaDataPair structure]
# See http://bob.nem.ninja/docs/#accountMetaDataPair
nis.request(:post, '/account/unlock',
privateKey: '00983bb01d05edecfaef55df9486c111abb6299c754a002069b1d0ef4537441bda'
)
# => Nothing
# See http://bob.nem.ninja/docs/#locking-and-unlocking-accounts
Documentation
Available at rubydoc.info.
Commandline
$ nis status # => {"code":6,"type":4,"message":"status"}
$ nis heartbeat # => {"code":1,"type":2,"message":"ok"}
$ nis request get account/get --params=address:TALICELCD3XPH4FFI5STGGNSNSWPOTG5E4DS2TOS
# => [AccountMetaDataPair structure]
Connection
Environment Variable
$ export NIS_URL=http://bigalice3.nem.ninja:7890
$ nis heartbeat # => {"code":1,"type":2,"message":"ok"}
Hash
# Passing hostname
Nis.new(host: 'bigalice3.nem.ninja')
# Passing url
Nis.new(url: 'http://bigalice3.nem.ninja:7890')
TODO
- Do more improvements.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/nis-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
License
The gem is available as open source under the terms of the MIT License.