Class: PawClient::Configuration
- Inherits:
-
Object
- Object
- PawClient::Configuration
- Defined in:
- lib/paw_client/configuration.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#test_mode ⇒ Object
Returns the value of attribute test_mode.
-
#token ⇒ Object
Returns the value of attribute token.
-
#user_token ⇒ Object
Returns the value of attribute user_token.
-
#uuid ⇒ Object
Returns the value of attribute uuid.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(attrs = {}) ⇒ Configuration
Returns a new instance of Configuration.
27 28 29 30 31 32 33 34 |
# File 'lib/paw_client/configuration.rb', line 27 def initialize(attrs={}) self.base_url = attrs.fetch(:base_url, nil) self.uuid = attrs.fetch(:uuid, nil) self.token = attrs.fetch(:token, nil) self.user_token = attrs.fetch(:user_token, nil) self.logger = attrs.fetch(:logger, nil) self.test_mode = attrs.fetch(:test_mode, false) end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
4 5 6 |
# File 'lib/paw_client/configuration.rb', line 4 def base_url @base_url end |
#logger ⇒ Object
Returns the value of attribute logger.
9 10 11 |
# File 'lib/paw_client/configuration.rb', line 9 def logger @logger end |
#test_mode ⇒ Object
Returns the value of attribute test_mode.
8 9 10 |
# File 'lib/paw_client/configuration.rb', line 8 def test_mode @test_mode end |
#token ⇒ Object
Returns the value of attribute token.
6 7 8 |
# File 'lib/paw_client/configuration.rb', line 6 def token @token end |
#user_token ⇒ Object
Returns the value of attribute user_token.
7 8 9 |
# File 'lib/paw_client/configuration.rb', line 7 def user_token @user_token end |
#uuid ⇒ Object
Returns the value of attribute uuid.
5 6 7 |
# File 'lib/paw_client/configuration.rb', line 5 def uuid @uuid end |
Class Method Details
.from_yaml(path, env = nil) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/paw_client/configuration.rb', line 36 def self.from_yaml(path, env=nil) attrs = YAML.load_file(path) attrs = attrs[env] if env sym_attrs=attrs.each_with_object({}) {|(k, v), memo| memo[k.to_sym] = v} self.new(sym_attrs) end |