Class: Exchanger::Config
- Inherits:
-
Object
- Object
- Exchanger::Config
- Includes:
- Singleton
- Defined in:
- lib/exchanger/config.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#insecure_ssl ⇒ Object
Returns the value of attribute insecure_ssl.
-
#password ⇒ Object
Returns the value of attribute password.
-
#ssl_version ⇒ Object
Returns the value of attribute ssl_version.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#from_hash(settings) ⇒ Object
Configure Exchanger client from a hash.
-
#initialize ⇒ Config
constructor
A new instance of Config.
-
#reset ⇒ Object
Reset the configuration options to the defaults.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
7 8 9 |
# File 'lib/exchanger/config.rb', line 7 def initialize reset end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/exchanger/config.rb', line 5 def debug @debug end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/exchanger/config.rb', line 5 def endpoint @endpoint end |
#insecure_ssl ⇒ Object
Returns the value of attribute insecure_ssl.
5 6 7 |
# File 'lib/exchanger/config.rb', line 5 def insecure_ssl @insecure_ssl end |
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/exchanger/config.rb', line 5 def password @password end |
#ssl_version ⇒ Object
Returns the value of attribute ssl_version.
5 6 7 |
# File 'lib/exchanger/config.rb', line 5 def ssl_version @ssl_version end |
#timeout ⇒ Object
Returns the value of attribute timeout.
5 6 7 |
# File 'lib/exchanger/config.rb', line 5 def timeout @timeout end |
#username ⇒ Object
Returns the value of attribute username.
5 6 7 |
# File 'lib/exchanger/config.rb', line 5 def username @username end |
Instance Method Details
#from_hash(settings) ⇒ Object
Configure Exchanger client from a hash. This is usually called after parsing a yaml config file such as exchanger.yml.
Example:
Exchanger::Config.instance.from_hash({})
28 29 30 31 32 |
# File 'lib/exchanger/config.rb', line 28 def from_hash(settings) settings.each do |name, value| send("#{name}=", value) if respond_to?("#{name}=") end end |
#reset ⇒ Object
Reset the configuration options to the defaults.
12 13 14 15 16 17 18 19 20 |
# File 'lib/exchanger/config.rb', line 12 def reset @endpoint = nil @timeout = 5 @username = nil @password = nil @debug = false @insecure_ssl = false @ssl_version = nil end |