class Cryptoprocessing::Client
Cryptoprocessing
API client masks default currency with BTC. But default currency can be simply overridden with blockchain_type property.
Attributes
Public Class Methods
Create and configure a logger @return [Logger]
# File lib/cryptoprocessing/client.rb, line 62 def self.default_logger logger = Logger.new($stdout) logger.level = Logger::WARN logger end
@!attribute [rw] logger @return [Logger] The logger.
# File lib/cryptoprocessing/client.rb, line 56 def self.logger @logger ||= rails_logger || default_logger end
# File lib/cryptoprocessing/client.rb, line 29 def initialize(options = {}) # Use options passed in, but fall back to module defaults Cryptoprocessing::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", options[key] || Cryptoprocessing.instance_variable_get(:"@#{key}")) end # login_from_netrc unless user_authenticated? || application_authenticated? end
Check to see if client is being used in a Rails
environment and get the logger if present. Setting the ENV variable 'GOOGLE_API_USE_RAILS_LOGGER' to false will force the client to use its own logger.
@return [Logger]
# File lib/cryptoprocessing/client.rb, line 73 def self.rails_logger if 'true' == ENV.fetch('CRYPTOPROCESSING_USE_RAILS_LOGGER', 'true') && defined?(::Rails) && ::Rails.respond_to?(:logger) && !::Rails.logger.nil? ::Rails.logger else nil end end
Public Instance Methods
Set access token for authentication
@param value [String] 40 character Cryptoprocessing
access token
# File lib/cryptoprocessing/client.rb, line 103 def access_token=(value) reset_agent @access_token = value end
Set username for authentication
@param value [String] Cryptoprocessing
username
# File lib/cryptoprocessing/client.rb, line 87 def email=(value) reset_agent @email = value end
Text representation of the client, masking tokens and passwords
@return [String]
# File lib/cryptoprocessing/client.rb, line 41 def inspect inspected = super # mask password inspected = inspected.gsub! @password, "*******" if @password # Only show last 4 of token, secret if @access_token inspected = inspected.gsub! @access_token, "#{'*'*36}#{@access_token[36..-1]}" end inspected end
Set password for authentication
@param value [String] Cryptoprocessing
password
# File lib/cryptoprocessing/client.rb, line 95 def password=(value) reset_agent @password = value end