Class: Minter::Api::Client

Constant Summary collapse

DEFAULT_NODE_URL =
"https://node-api.testnet.minter.network/v2"
DEFAULT_TIMEOUT =
30
API_VERSION =
2

Constants included from Connection

Minter::Api::Connection::DEFAULT_HEADERS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ValidatorsResource

#validators

Methods included from TransactionsResource

#transaction_info, #transactions, #unconfirmed_transactions

Methods included from StatusResource

#status

Methods included from SendTransactionResource

#send_transaction

Methods included from NonceResource

#nonce

Methods included from MissedBlocksResource

#missed_blocks

Methods included from MaxGasResource

#max_gas

Methods included from MinGasPriceResource

#min_gas_price

Methods included from EventsResource

#events

Methods included from EstimateResource

#estimate_coin_buy, #estimate_coin_sell, #estimate_coin_sell_all, #estimate_tx_comission

Methods included from Connection

#check_params

Methods included from CoinResource

#coin_info

Methods included from CandidateResource

#candidate, #candidates

Methods included from BlockResource

#block

Methods included from AddressResource

#address

Constructor Details

#initialize(args = {}) ⇒ Client

Returns a new instance of Client.



36
37
38
39
40
41
# File 'lib/minter/api/client.rb', line 36

def initialize(args = {})
  self.node_url = ENV["NODE_URL"] || DEFAULT_NODE_URL
  self.connect_timeout = args[:connect_timeout] || DEFAULT_TIMEOUT
  self.read_timeout = args[:read_timeout] || DEFAULT_TIMEOUT
  self.write_timeout = args[:write_timeout] || DEFAULT_TIMEOUT
end

Instance Attribute Details

#api_versionObject

Returns the value of attribute api_version.



14
15
16
# File 'lib/minter/api/client.rb', line 14

def api_version
  @api_version
end

#authenticated_api_urlObject

Returns the value of attribute authenticated_api_url.



14
15
16
# File 'lib/minter/api/client.rb', line 14

def authenticated_api_url
  @authenticated_api_url
end

#connect_timeoutObject

Returns the value of attribute connect_timeout.



15
16
17
# File 'lib/minter/api/client.rb', line 15

def connect_timeout
  @connect_timeout
end

#node_urlObject

Returns the value of attribute node_url.



14
15
16
# File 'lib/minter/api/client.rb', line 14

def node_url
  @node_url
end

#proxyObject

Returns the value of attribute proxy.



15
16
17
# File 'lib/minter/api/client.rb', line 15

def proxy
  @proxy
end

#read_timeoutObject

Returns the value of attribute read_timeout.



15
16
17
# File 'lib/minter/api/client.rb', line 15

def read_timeout
  @read_timeout
end

#write_timeoutObject

Returns the value of attribute write_timeout.



15
16
17
# File 'lib/minter/api/client.rb', line 15

def write_timeout
  @write_timeout
end

Instance Method Details

#configObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/minter/api/client.rb', line 43

def config
  {
    node_url: node_url,
    authenticated_api_url: authenticated_api_url,
    api_version: api_version,
    connect_timeout: connect_timeout,
    read_timeout: read_timeout,
    write_timeout: write_timeout,
    proxy: proxy
  }
end