Class: Minter::Api::Client
- Inherits:
-
Object
- Object
- Minter::Api::Client
- Includes:
- AddressResource, BlockResource, CandidateResource, CoinResource, Connection, EstimateResource, EventsResource, MaxGasResource, MinGasPriceResource, MissedBlocksResource, NonceResource, SendTransactionResource, StatusResource, TransactionsResource, ValidatorsResource
- Defined in:
- lib/minter/api/client.rb
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
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#authenticated_api_url ⇒ Object
Returns the value of attribute authenticated_api_url.
-
#connect_timeout ⇒ Object
Returns the value of attribute connect_timeout.
-
#node_url ⇒ Object
Returns the value of attribute node_url.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#read_timeout ⇒ Object
Returns the value of attribute read_timeout.
-
#write_timeout ⇒ Object
Returns the value of attribute write_timeout.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(args = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from ValidatorsResource
Methods included from TransactionsResource
#transaction_info, #transactions, #unconfirmed_transactions
Methods included from StatusResource
Methods included from SendTransactionResource
Methods included from NonceResource
Methods included from MissedBlocksResource
Methods included from MaxGasResource
Methods included from MinGasPriceResource
Methods included from EventsResource
Methods included from EstimateResource
#estimate_coin_buy, #estimate_coin_sell, #estimate_coin_sell_all, #estimate_tx_comission
Methods included from Connection
Methods included from CoinResource
Methods included from CandidateResource
Methods included from BlockResource
Methods included from AddressResource
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_version ⇒ Object
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_url ⇒ Object
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_timeout ⇒ Object
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_url ⇒ Object
Returns the value of attribute node_url.
14 15 16 |
# File 'lib/minter/api/client.rb', line 14 def node_url @node_url end |
#proxy ⇒ Object
Returns the value of attribute proxy.
15 16 17 |
# File 'lib/minter/api/client.rb', line 15 def proxy @proxy end |
#read_timeout ⇒ Object
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_timeout ⇒ Object
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
#config ⇒ Object
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 |