Class: CardanoWallet::Base
- Inherits:
-
Object
- Object
- CardanoWallet::Base
- Includes:
- HTTParty
- Defined in:
- lib/cardano_wallet/base.rb
Overview
Base class for all APIs
Direct Known Subclasses
CardanoWallet::Byron::Addresses, CardanoWallet::Byron::Assets, CardanoWallet::Byron::CoinSelections, CardanoWallet::Byron::Init, CardanoWallet::Byron::Migrations, CardanoWallet::Byron::Transactions, CardanoWallet::Byron::Wallets, Misc::Init, Misc::Network, Misc::Node, Misc::Proxy, Misc::Settings, Misc::Utils, Shared::Addresses, Shared::Init, Shared::Keys, Shared::Transactions, Shared::Wallets, Shelley::Addresses, Shelley::Assets, Shelley::CoinSelections, Shelley::Init, Shelley::Keys, Shelley::Migrations, Shelley::StakePools, Shelley::Transactions, Shelley::Wallets, Utils::Mnemonic
Instance Attribute Summary collapse
-
#opt ⇒ Object
Returns the value of attribute opt.
Instance Method Summary collapse
-
#byron ⇒ Object
Init API for Byron.
-
#initialize(opt = {}) ⇒ Base
constructor
Initialize CardanoWallet.
-
#misc ⇒ Object
Init API for Misc.
-
#shared ⇒ Object
Init API for Shared wallets.
-
#shelley ⇒ Object
Init API for Shelley.
-
#utils ⇒ Object
Init API for Utils.
Constructor Details
#initialize(opt = {}) ⇒ Base
Initialize CardanoWallet.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cardano_wallet/base.rb', line 21 def initialize(opt = {}) raise ArgumentError, 'argument should be Hash' unless opt.is_a?(Hash) opt[:protocol] ||= 'http' opt[:host] ||= 'localhost' opt[:port] ||= 8090 opt[:url] ||= "#{opt[:protocol]}://#{opt[:host]}:#{opt[:port]}/v2" opt[:cacert] ||= '' opt[:pem] ||= '' opt[:timeout] ||= -1 self.class.base_uri opt[:url] self.class.default_timeout(opt[:timeout].to_i) unless opt[:timeout] == -1 unless opt[:cacert].empty? ENV['SSL_CERT_FILE'] = opt[:cacert] self.class.ssl_ca_file(File.read(ENV.fetch('SSL_CERT_FILE', nil))) end self.class.pem(File.read(opt[:pem])) unless opt[:pem].empty? @opt = opt end |
Instance Attribute Details
#opt ⇒ Object
Returns the value of attribute opt.
9 10 11 |
# File 'lib/cardano_wallet/base.rb', line 9 def opt @opt end |
Instance Method Details
#byron ⇒ Object
Init API for Byron
54 55 56 |
# File 'lib/cardano_wallet/base.rb', line 54 def byron Byron.new @opt end |
#misc ⇒ Object
Init API for Misc
59 60 61 |
# File 'lib/cardano_wallet/base.rb', line 59 def misc Misc.new @opt end |
#shared ⇒ Object
Init API for Shared wallets
49 50 51 |
# File 'lib/cardano_wallet/base.rb', line 49 def shared Shared.new @opt end |