Module: Gensee::Configurable
- Included in:
- Gensee
- Defined in:
- lib/gensee/configurable.rb
Constant Summary collapse
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#login ⇒ Object
Returns the value of attribute login.
-
#password ⇒ Object
Returns the value of attribute password.
Class Method Summary collapse
- .default_options ⇒ Object
-
.keys ⇒ Array
List all keys.
- .user_agent ⇒ Object
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Set configuration options using a block.
- #options ⇒ Object
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/gensee/configurable.rb', line 3 def endpoint @endpoint end |
#login ⇒ Object
Returns the value of attribute login.
3 4 5 |
# File 'lib/gensee/configurable.rb', line 3 def login @login end |
#password ⇒ Object
Returns the value of attribute password.
3 4 5 |
# File 'lib/gensee/configurable.rb', line 3 def password @password end |
Class Method Details
.default_options ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/gensee/configurable.rb', line 13 def { endpoint: ENV['GENSEE_ENDPOINT'], login: ENV['GENSEE_LOGIN'], password: ENV['GENSEE_PASSWORD'] } end |
.keys ⇒ Array
List all keys
9 10 11 |
# File 'lib/gensee/configurable.rb', line 9 def keys @keys ||= [:endpoint, :login, :password] end |
.user_agent ⇒ Object
21 22 23 |
# File 'lib/gensee/configurable.rb', line 21 def user_agent ENV['GENSEE_USER_AGENT'] || USER_AGENT end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
34 35 36 |
# File 'lib/gensee/configurable.rb', line 34 def configure yield self end |
#options ⇒ Object
26 27 28 29 30 31 |
# File 'lib/gensee/configurable.rb', line 26 def ary = Gensee::Configurable.keys.map do |key| [key, send(key) || Gensee::Configurable.[key]] end Hash[ary] end |