Module: Cryptoprocessing::Configurable
- Included in:
- Cryptoprocessing, Client
- Defined in:
- lib/cryptoprocessing/configurable.rb
Overview
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_endpoint ⇒ String
Base URL for API requests.
- #api_namespace ⇒ Object
-
#blockchain_type ⇒ Object
Returns the value of attribute blockchain_type.
-
#email ⇒ Object
writeonly
Sets the attribute email.
-
#password ⇒ Object
writeonly
Sets the attribute password.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
Class Method Summary collapse
-
.keys ⇒ Array
List of configurable keys for Client.
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Set configuration options using a block.
- #netrc? ⇒ Boolean
-
#reset! ⇒ Object
(also: #setup)
Reset configuration options to default values.
-
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options.
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
8 9 10 |
# File 'lib/cryptoprocessing/configurable.rb', line 8 def access_token @access_token end |
#api_endpoint ⇒ String
Returns Base URL for API requests.
11 |
# File 'lib/cryptoprocessing/configurable.rb', line 11 attr_writer :email, :password, :api_endpoint, :api_namespace |
#api_namespace ⇒ Object
59 60 61 |
# File 'lib/cryptoprocessing/configurable.rb', line 59 def api_namespace File.join(@api_namespace, '') end |
#blockchain_type ⇒ Object
Returns the value of attribute blockchain_type.
8 9 10 |
# File 'lib/cryptoprocessing/configurable.rb', line 8 def blockchain_type @blockchain_type end |
#email=(value) ⇒ Object (writeonly)
Sets the attribute email
11 12 13 |
# File 'lib/cryptoprocessing/configurable.rb', line 11 def email=(value) @email = value end |
#password=(value) ⇒ Object (writeonly)
Sets the attribute password
11 12 13 |
# File 'lib/cryptoprocessing/configurable.rb', line 11 def password=(value) @password = value end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
8 9 10 |
# File 'lib/cryptoprocessing/configurable.rb', line 8 def user_agent @user_agent end |
Class Method Details
.keys ⇒ Array
List of configurable keys for Cryptoprocessing::Client
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/cryptoprocessing/configurable.rb', line 16 def keys @keys ||= [ :access_token, :api_endpoint, :api_namespace, :blockchain_type, :email, :password, :user_agent ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
30 31 32 |
# File 'lib/cryptoprocessing/configurable.rb', line 30 def configure yield self end |
#netrc? ⇒ Boolean
63 64 65 |
# File 'lib/cryptoprocessing/configurable.rb', line 63 def netrc? !!@netrc end |
#reset! ⇒ Object Also known as: setup
Reset configuration options to default values
35 36 37 38 39 40 |
# File 'lib/cryptoprocessing/configurable.rb', line 35 def reset! Cryptoprocessing::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Cryptoprocessing::Default.[key]) end self end |
#same_options?(opts) ⇒ Boolean
Compares client options to a Hash of requested options
47 48 49 |
# File 'lib/cryptoprocessing/configurable.rb', line 47 def (opts) opts.hash == .hash end |