Module: Bitreserve::Options

Included in:
Client
Defined in:
lib/bitreserve/options.rb

Constant Summary collapse

API_BASE =
'https://api.bitreserve.org'
SANDBOX_API_BASE =
'https://api-sandbox.bitreserve.org'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/bitreserve/options.rb', line 3

def options
  @options
end

Instance Method Details

#authorization_headerObject



15
16
17
18
19
# File 'lib/bitreserve/options.rb', line 15

def authorization_header
  return {} unless bearer_token?

  { 'Authorization' => "Bearer #{bearer_token}" }
end

#bearer_tokenObject



11
12
13
# File 'lib/bitreserve/options.rb', line 11

def bearer_token
  @bearer_token ||= (options[:token] || ENV['BITRESERVE_AUTH_TOKEN'])
end

#bearer_token?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/bitreserve/options.rb', line 7

def bearer_token?
  !bearer_token.nil?
end