class Provide::Services::NChain
Public Class Methods
new(scheme = 'http', host, token)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 5 def initialize(scheme = 'http', host, token) @scheme = scheme @host = host @token = token end
Public Instance Methods
account_balance(account_id, token_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 19 def account_balance(account_id, token_id) parse client.get "accounts/#{account_id}/balances/#{token_id}" end
account_details(account_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 15 def account_details(account_id) parse client.get "accounts/#{account_id}" end
accounts(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 11 def accounts(params = nil) parse client.get 'accounts', (params || {}) end
bridge_details(bridge_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 31 def bridge_details(bridge_id) parse client.get "bridges/#{bridge_id}" end
bridges(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 27 def bridges(params = nil) parse client.get 'bridges', (params || {}) end
connector_details(connector_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 43 def connector_details(connector_id) parse client.get "connectors/#{connector_id}" end
connector_load_balancers(connector_id, params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 47 def connector_load_balancers(connector_id, params = nil) parse client.get "connectors/#{connector_id}/load_balancers", (params || {}) end
connector_nodes(connector_id, params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 51 def connector_nodes(connector_id, params = nil) parse client.get "connectors/#{connector_id}/nodes", (params || {}) end
connectors(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 39 def connectors(params = nil) parse client.get 'connectors', (params || {}) end
contract_details(contract_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 67 def contract_details(contract_id) parse client.get "contracts/#{contract_id}" end
contracts(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 63 def contracts(params = nil) parse client.get 'contracts', (params || {}) end
create_account(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 23 def create_account(params) parse client.post 'accounts', params end
create_bridge(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 35 def create_bridge(params) parse client.post 'bridges', params end
create_connector(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 55 def create_connector(params) parse client.post 'connectors', params end
create_contract(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 71 def create_contract(params) parse client.post 'contracts', params end
create_network(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 83 def create_network(params) parse client.post 'networks', params end
create_network_node(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 151 def create_network_node(network_id, params) parse client.post "networks/#{network_id}/nodes", params end
create_oracle(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 175 def create_oracle(params) parse client.post 'oracles', params end
create_token(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 191 def create_token(params) parse client.post 'tokens', params end
create_transaction(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 195 def create_transaction(params) parse client.post 'transactions', params end
create_wallet(params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 215 def create_wallet(params) parse client.post 'wallets', params end
destroy_connector(connector_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 59 def destroy_connector(connector_id) parse client.delete "connectors/#{connector_id}" end
destroy_network_node(network_id, node_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 163 def destroy_network_node(network_id, node_id) parse client.delete "networks/#{network_id}/nodes/#{node_id}" end
execute_contract(contract_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 75 def execute_contract(contract_id, params) parse client.post "contracts/#{contract_id}/execute", params end
network_accounts(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 95 def network_accounts(network_id, params) parse client.get "networks/#{network_id}/accounts", params end
network_blocks(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 99 def network_blocks(network_id, params) parse client.get "networks/#{network_id}/blocks", params end
network_bridges(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 103 def network_bridges(network_id, params) parse client.get "networks/#{network_id}/bridges", params end
network_connectors(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 107 def network_connectors(network_id, params) parse client.get "networks/#{network_id}/connectors", params end
network_contract_details(network_id, contract_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 115 def network_contract_details(network_id, contract_id) parse client.get "networks/#{network_id}/contracts/#{contract_id}" end
network_contracts(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 111 def network_contracts(network_id, params) parse client.get "networks/#{network_id}/contracts", params end
network_details(network_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 91 def network_details(network_id) parse client.get "networks/#{network_id}" end
network_load_balancers(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 119 def network_load_balancers(network_id, params) parse client.get "networks/#{network_id}/load_balancers", params end
network_node_details(network_id, node_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 155 def network_node_details(network_id, node_id) parse client.get "networks/#{network_id}/nodes/#{node_id}" end
network_node_logs(network_id, node_id, params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 159 def network_node_logs(network_id, node_id, params = nil) parse client.get "networks/#{network_id}/nodes/#{node_id}/logs", (params || {}) end
network_nodes(network_id, params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 147 def network_nodes(network_id, params = nil) parse client.get "networks/#{network_id}/nodes", (params || {}) end
network_oracles(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 127 def network_oracles(network_id, params) parse client.get "networks/#{network_id}/oracles", params end
network_status(network_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 143 def network_status(network_id) parse client.get "networks/#{network_id}/status" end
network_tokens(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 131 def network_tokens(network_id, params) parse client.get "networks/#{network_id}/tokens", params end
network_transaction_details(network_id, transaction_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 139 def network_transaction_details(network_id, transaction_id) parse client.get "networks/#{network_id}/transactions/#{transaction_id}" end
network_transactions(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 135 def network_transactions(network_id, params) parse client.get "networks/#{network_id}/transactions", params end
networks(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 79 def networks(params = nil) parse client.get 'networks', (params || {}) end
oracle_details(oracle_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 171 def oracle_details(oracle_id) parse client.get "oracles/#{oracle_id}" end
oracles(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 167 def oracles(params = nil) parse client.get 'oracles', (params || {}) end
prices(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 179 def prices(params = nil) parse client.get 'prices', (params || {}) end
token_details(token_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 187 def token_details(token_id) parse client.get "tokens/#{token_id}" end
tokens(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 183 def tokens(params = nil) parse client.get 'tokens', (params || {}) end
transaction_details(tx_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 203 def transaction_details(tx_id) parse client.get "transactions/#{tx_id}" end
transactions(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 199 def transactions(params = nil) parse client.get 'transactions', (params || {}) end
update_network(network_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 87 def update_network(network_id, params) parse client.put "networks/#{network_id}", params end
update_network_load_balancers(network_id, load_balancer_id, params)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 123 def update_network_load_balancers(network_id, load_balancer_id, params) parse client.put "networks/#{network_id}/load_balancers/#{load_balancer_id}", params end
wallet_details(wallet_id)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 211 def wallet_details(wallet_id) parse client.get "wallets/#{wallet_id}" end
wallets(params = nil)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 207 def wallets(params = nil) parse client.get 'wallets', (params || {}) end
Private Instance Methods
client()
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 221 def client @client ||= begin Provide::ApiClient.new(@scheme, @host, 'api/v1/', @token) end end
parse(response)
click to toggle source
# File lib/provide-ruby/services/nchain.rb, line 227 def parse(response) begin body = response.code == 204 ? nil : JSON.parse(response.body) return response.code, response.headers, body rescue raise Exception.new({ :code => response.code, }) end end