module Cryptoprocessing::Configurable

Configuration options for {Client}, defaulting to values in {Default}

Attributes

access_token[RW]

@!attribute [w] access_token

@return [String] Access token for authentication
api_endpoint[W]

@!attribute api_endpoint

@return [String] Base URL for API requests.
api_namespace[W]

@!attribute api_endpoint

@return [String] Base URL for API requests.
blockchain_type[RW]

@!attribute [w] access_token

@return [String] Access token for authentication
email[W]

@!attribute api_endpoint

@return [String] Base URL for API requests.
password[W]

@!attribute api_endpoint

@return [String] Base URL for API requests.
user_agent[RW]

@!attribute [w] access_token

@return [String] Access token for authentication

Public Class Methods

keys() click to toggle source

List of configurable keys for {Cryptoprocessing::Client} @return [Array] of option keys

# File lib/cryptoprocessing/configurable.rb, line 16
def keys
  @keys ||= [
      :access_token,
      :api_endpoint,
      :api_namespace,
      :blockchain_type,
      :email,
      :password,
      :user_agent
  ]
end

Public Instance Methods

api_endpoint() click to toggle source
# File lib/cryptoprocessing/configurable.rb, line 55
def api_endpoint
  File.join(@api_endpoint, '')
end
api_namespace() click to toggle source
# File lib/cryptoprocessing/configurable.rb, line 59
def api_namespace
  File.join(@api_namespace, '')
end
configure() { |self| ... } click to toggle source

Set configuration options using a block

# File lib/cryptoprocessing/configurable.rb, line 30
def configure
  yield self
end
netrc?() click to toggle source
# File lib/cryptoprocessing/configurable.rb, line 63
def netrc?
  !!@netrc
end
reset!() click to toggle source

Reset configuration options to default values

# File lib/cryptoprocessing/configurable.rb, line 35
def reset!
  Cryptoprocessing::Configurable.keys.each do |key|
    instance_variable_set(:"@#{key}", Cryptoprocessing::Default.options[key])
  end
  self
end
Also aliased as: setup
same_options?(opts) click to toggle source

Compares client options to a Hash of requested options

@param opts [Hash] Options to compare with current client options @return [Boolean]

# File lib/cryptoprocessing/configurable.rb, line 47
def same_options?(opts)
  opts.hash == options.hash
end
setup()
Alias for: reset!

Private Instance Methods

options() click to toggle source
# File lib/cryptoprocessing/configurable.rb, line 69
def options
  Hash[Cryptoprocessing::Configurable.keys.map{|key| [key, instance_variable_get(:"@#{key}")]}]
end