Class: Radiator::SSC::BaseSteemSmartContractRPC

Inherits:
Object
  • Object
show all
Defined in:
lib/radiator/ssc/base_steem_smart_contract_rpc.rb

Direct Known Subclasses

Blockchain, Contracts

Constant Summary collapse

POST_HEADERS =
{
  'Content-Type' => 'application/json',
  'User-Agent' => Radiator::AGENT_ID
}

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BaseSteemSmartContractRPC

Returns a new instance of BaseSteemSmartContractRPC.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/radiator/ssc/base_steem_smart_contract_rpc.rb', line 10

def initialize(options = {})
  @root_url = options[:root_url] || 'https://api.steem-engine.com/rpc'
  
  @self_hashie_logger = false
  @hashie_logger = if options[:hashie_logger].nil?
    @self_hashie_logger = true
    Logger.new(nil)
  else
    options[:hashie_logger]
  end
  
  unless @hashie_logger.respond_to? :warn
    @hashie_logger = Logger.new(@hashie_logger)
  end
  
  @reuse_ssl_sessions = if options.keys.include? :reuse_ssl_sessions
    options[:reuse_ssl_sessions]
  else
    true
  end
  
  if defined? Net::HTTP::Persistent::DEFAULT_POOL_SIZE
    @pool_size = options[:pool_size] || Net::HTTP::Persistent::DEFAULT_POOL_SIZE
  end
  
  Hashie.logger = @hashie_logger
  @uri = nil
  @http_id = nil
  @http = nil
  @max_requests = options[:max_requests] || 30
end

Instance Method Details

#shutdownObject

Stops the persistant http connections.



44
45
46
47
48
# File 'lib/radiator/ssc/base_steem_smart_contract_rpc.rb', line 44

def shutdown
  @uri = nil
  @http_id = nil
  @http = nil
end