Module: ActiveRemote::Search
- Included in:
- Base
- Defined in:
- lib/active_remote/search.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
Instance Method Summary collapse
-
#_active_remote_search(args) ⇒ Object
Search for the given resource.
-
#reload ⇒ Object
Reload this record from the remote service.
Class Method Details
.included(klass) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/active_remote/search.rb', line 6 def self.included(klass) klass.class_eval do extend ::ActiveRemote::Search::ClassMethods include ::ActiveRemote::Persistence include ::ActiveRemote::RPC define_model_callbacks :search end end |
Instance Method Details
#_active_remote_search(args) ⇒ Object
Search for the given resource. Auto-paginates (i.e. continues searching for records matching the given search args until all records have been retrieved) if no pagination options are given.
118 119 120 121 122 |
# File 'lib/active_remote/search.rb', line 118 def _active_remote_search(args) run_callbacks :search do execute(:search, args) end end |
#reload ⇒ Object
Reload this record from the remote service.
126 127 128 129 130 131 |
# File 'lib/active_remote/search.rb', line 126 def reload _active_remote_search(:guid => self.guid) fresh_object = self.class.new(last_response.to_hash) @attributes.update(fresh_object.instance_variable_get('@attributes')) end |