Module: RubyShift::Configuration
- Included in:
- RubyShift
- Defined in:
- lib/rubyshift/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[:endpoint, :username, :password, :access_token, :user_agent, :httparty].freeze
- DEFAULT_ENDPOINT =
'https://openshift.redhat.com/broker/rest'- DEFAULT_USER_AGENT =
"RubyShift/#{RubyShift::VERSION}".freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exetended(base) ⇒ Object
13 14 15 |
# File 'lib/rubyshift/configuration.rb', line 13 def self.exetended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
17 18 19 |
# File 'lib/rubyshift/configuration.rb', line 17 def configure yield self end |
#options ⇒ Object
21 22 23 24 25 |
# File 'lib/rubyshift/configuration.rb', line 21 def VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end |
#reset ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/rubyshift/configuration.rb', line 27 def reset self.endpoint = ENV['RUBYSHIFT_ENDPOINT'] self.username = ENV['RUBYSHIFT_USERNAME'] self.password = ENV['RUBYSHIFT_PASSWORD'] self.access_token = ENV['RUBYSHIFT_ACCESS_TOKEN'] self.httparty = get_httparty_config(ENV['RUBYSHIFT_HTTPARTY_OPTIONS']) self.user_agent = DEFAULT_USER_AGENT end |