Class: RemoteResource::ConnectionOptions
- Inherits:
-
Object
- Object
- RemoteResource::ConnectionOptions
- Defined in:
- lib/remote_resource/connection_options.rb
Constant Summary collapse
- AVAILABLE_OPTIONS =
[:site, :headers, :default_headers, :version, :path_prefix, :path_postfix, :collection_prefix, :extension, :collection, :collection_name, :root_element].freeze
Instance Attribute Summary collapse
-
#base_class ⇒ Object
readonly
Returns the value of attribute base_class.
Instance Method Summary collapse
-
#initialize(base_class) ⇒ ConnectionOptions
constructor
A new instance of ConnectionOptions.
- #merge(options = {}) ⇒ Object
- #reload ⇒ Object
- #reload! ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(base_class) ⇒ ConnectionOptions
Returns a new instance of ConnectionOptions.
8 9 10 11 |
# File 'lib/remote_resource/connection_options.rb', line 8 def initialize(base_class) @base_class = base_class self.send :initialize_connection_options end |
Instance Attribute Details
#base_class ⇒ Object (readonly)
Returns the value of attribute base_class.
6 7 8 |
# File 'lib/remote_resource/connection_options.rb', line 6 def base_class @base_class end |
Instance Method Details
#merge(options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/remote_resource/connection_options.rb', line 13 def merge( = {}) .each do |option, value| self.public_send "#{option}=", value end and self end |
#reload ⇒ Object
25 26 27 |
# File 'lib/remote_resource/connection_options.rb', line 25 def reload end |
#reload! ⇒ Object
29 30 31 |
# File 'lib/remote_resource/connection_options.rb', line 29 def reload! reload and self end |
#to_hash ⇒ Object
19 20 21 22 23 |
# File 'lib/remote_resource/connection_options.rb', line 19 def to_hash AVAILABLE_OPTIONS.each_with_object(Hash.new) do |option, hash| hash[option] = self.public_send option end end |