Sha256: 3dd794b53c3fe53eee523854524c943dbf49661645a71244a4d9108953af56d3
Contents?: true
Size: 1.19 KB
Versions: 18
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true module CardanoWallet ## # Base class for all APIs class Base include HTTParty attr_accessor :opt 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['SSL_CERT_FILE'])) end self.class.pem(File.read(opt[:pem])) unless opt[:pem].empty? @opt = opt end # Init API for Shelley def shelley Shelley.new @opt end # Init API for Shared wallets def shared Shared.new @opt end # Init API for Byron def byron Byron.new @opt end # Init API for Misc def misc Misc.new @opt end # Init API for Proxy def proxy Proxy.new @opt end end end
Version data entries
18 entries across 18 versions & 1 rubygems