Module: Bucketkit::Configurable
Instance Attribute Summary collapse
- #api_endpoint ⇒ Object
-
#auto_paginate ⇒ Object
Returns the value of attribute auto_paginate.
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#default_media_type ⇒ Object
Returns the value of attribute default_media_type.
- #login ⇒ Object
-
#middleware ⇒ Object
Returns the value of attribute middleware.
-
#oauth_tokens ⇒ Object
Returns the value of attribute oauth_tokens.
-
#password ⇒ Object
writeonly
Sets the attribute password.
-
#per_page ⇒ Object
Returns the value of attribute per_page.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
- #web_endpoint ⇒ Object
Class Method Summary collapse
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
- #reset! ⇒ Object (also: #setup)
Instance Attribute Details
#api_endpoint ⇒ Object
38 39 40 |
# File 'lib/bucketkit/configurable.rb', line 38 def api_endpoint File.join @api_endpoint, '' end |
#auto_paginate ⇒ Object
Returns the value of attribute auto_paginate.
3 4 5 |
# File 'lib/bucketkit/configurable.rb', line 3 def auto_paginate @auto_paginate end |
#connection_options ⇒ Object
Returns the value of attribute connection_options.
3 4 5 |
# File 'lib/bucketkit/configurable.rb', line 3 def end |
#default_media_type ⇒ Object
Returns the value of attribute default_media_type.
3 4 5 |
# File 'lib/bucketkit/configurable.rb', line 3 def default_media_type @default_media_type end |
#login ⇒ Object
46 47 48 49 50 |
# File 'lib/bucketkit/configurable.rb', line 46 def login @login ||= begin user.login if basic_authenticated? end end |
#middleware ⇒ Object
Returns the value of attribute middleware.
3 4 5 |
# File 'lib/bucketkit/configurable.rb', line 3 def middleware @middleware end |
#oauth_tokens ⇒ Object
Returns the value of attribute oauth_tokens.
3 4 5 |
# File 'lib/bucketkit/configurable.rb', line 3 def oauth_tokens @oauth_tokens end |
#password=(value) ⇒ Object (writeonly)
Sets the attribute password
6 7 8 |
# File 'lib/bucketkit/configurable.rb', line 6 def password=(value) @password = value end |
#per_page ⇒ Object
Returns the value of attribute per_page.
3 4 5 |
# File 'lib/bucketkit/configurable.rb', line 3 def per_page @per_page end |
#proxy ⇒ Object
Returns the value of attribute proxy.
3 4 5 |
# File 'lib/bucketkit/configurable.rb', line 3 def proxy @proxy end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
3 4 5 |
# File 'lib/bucketkit/configurable.rb', line 3 def user_agent @user_agent end |
#web_endpoint ⇒ Object
42 43 44 |
# File 'lib/bucketkit/configurable.rb', line 42 def web_endpoint File.join @web_endpoint, '' end |
Class Method Details
.keys ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/bucketkit/configurable.rb', line 9 def keys @keys ||= [ :oauth_tokens, :auto_paginate, :per_page, :api_endpoint, :web_endpoint, :login, :password, :connection_options, :default_media_type, :middleware, :user_agent ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
26 27 28 |
# File 'lib/bucketkit/configurable.rb', line 26 def configure yield self end |
#reset! ⇒ Object Also known as: setup
30 31 32 33 34 35 |
# File 'lib/bucketkit/configurable.rb', line 30 def reset! Bucketkit::Configurable.keys.each { |key| instance_variable_set(:"@#{key}", Bucketkit::Default.[key]) } self end |