Method: Excoin::API#initialize

Defined in:
lib/excoin/api.rb

#initialize(api_key = nil, api_secret = nil, replay_strategy = nil, strategy_parameter = nil) ⇒ API

Returns a new instance of API.



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/excoin/api.rb', line 24

def initialize(api_key = nil, api_secret = nil, replay_strategy = nil, strategy_parameter = nil)
  @api_key = api_key
  @api_key ||= API_KEY if API_KEY =~ /\A[\w|-]{42,}/
  @api_secret = api_secret
  @api_secret ||= API_SECRET if API_SECRET =~ /\A[\w|-]{42,}/
  @account_accessible = !(@api_key.nil? or @api_secret.nil?)

  @api_replay_strategy = replay_strategy
  @api_replay_strategy ||= API_REPLAY_STRATEGY
  @api_replay_strategy_parameter = strategy_parameter
  @api_replay_strategy_parameter ||= ((EXPIRE_INTERVAL if @api_replay_strategy == "expire") or (NONCE_MULTIPLIER if @api_replay_strategy == "nonce"))
end