Class: Purest::Configuration
- Inherits:
-
Object
- Object
- Purest::Configuration
- Defined in:
- lib/purest/configuration.rb
Overview
Methods for configuring Purest
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#options ⇒ Object
Returns the value of attribute options.
-
#password ⇒ Object
Returns the value of attribute password.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(api_key = nil, api_version = nil, url = nil, username = nil, password = nil, options = {}) ⇒ Configuration
constructor
Override defaults for configuration.
- #load_yaml ⇒ Object
Constructor Details
#initialize(api_key = nil, api_version = nil, url = nil, username = nil, password = nil, options = {}) ⇒ Configuration
Override defaults for configuration
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/purest/configuration.rb', line 14 def initialize(api_key = nil, api_version = nil, url = nil, username = nil, password = nil, = {}) load_yaml if load_yaml @api_key = load_yaml['api_key'] @api_version = load_yaml['api_version'] @options = load_yaml['options'] @password = load_yaml['password'] @url = load_yaml['url'] @username = load_yaml['username'] else @api_key = api_key @api_version = api_version @options = @password = password @url = url @username = username end end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/purest/configuration.rb', line 6 def api_key @api_key end |
#api_version ⇒ Object
Returns the value of attribute api_version.
6 7 8 |
# File 'lib/purest/configuration.rb', line 6 def api_version @api_version end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/purest/configuration.rb', line 6 def @options end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/purest/configuration.rb', line 6 def password @password end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/purest/configuration.rb', line 6 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
6 7 8 |
# File 'lib/purest/configuration.rb', line 6 def username @username end |
Instance Method Details
#load_yaml ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/purest/configuration.rb', line 33 def load_yaml begin Psych.load_file(ENV['HOME'] + '/.purest.yaml') rescue Errno::ENOENT false end end |