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
}
MAX_BACKOFF =
60.0

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ BaseSteemSmartContractRPC

Returns a new instance of BaseSteemSmartContractRPC.

[View source]

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
41
42
43
44
45
46
47
48
# File 'lib/radiator/ssc/base_steem_smart_contract_rpc.rb', line 12

def initialize(options = {})
  @root_url = options[:root_url] || 'https://api.steem-engine.net/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
  
  @persist = if options[:persist].nil?
    true
  else
    options[:persist]
  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.

[View source]

52
53
54
55
56
# File 'lib/radiator/ssc/base_steem_smart_contract_rpc.rb', line 52

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