Class: SparkApi::Models::SavedSearch
- Extended by:
- Finders
- Includes:
- Concerns::Destroyable, Concerns::Savable
- Defined in:
- lib/spark_api/models/saved_search.rb
Constant Summary
Constants included from Paginate
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
-
#contacts ⇒ Object
list contacts (private role).
Methods included from Finders
Methods included from Concerns::Savable
#create!, #params_for_save, #post_data, #save, #save!, #update!
Methods included from Concerns::Destroyable
#destroy, #destroy!, #destroyed?
Methods inherited from Base
connection, #connection, count, element_name, element_name=, first, get, #initialize, #load, #method_missing, #parse_id, #path, path, #persisted?, prefix, prefix=, #resource_uri, #respond_to?
Methods included from Paginate
#collect, #paginate, #per_page
Methods included from Dirty
#changed, #changed?, #changed_attributes, #changes, #dirty_attributes, #previous_changes
Constructor Details
This class inherits a constructor from SparkApi::Models::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class SparkApi::Models::Base
Class Method Details
.provided ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/spark_api/models/saved_search.rb', line 11 def self.provided() Class.new(self).tap do |provided| provided.element_name = '/savedsearches' provided.prefix = '/provided' SparkApi.logger.info("#{self.name}.path: #{provided.path}") end end |
.tagged(tag, arguments = {}) ⇒ Object
19 20 21 |
# File 'lib/spark_api/models/saved_search.rb', line 19 def self.tagged(tag, arguments={}) collect(connection.get("/#{self.element_name}/tags/#{tag}", arguments)) end |
Instance Method Details
#contacts ⇒ Object
list contacts (private role)
24 25 26 27 28 |
# File 'lib/spark_api/models/saved_search.rb', line 24 def contacts return [] unless persisted? results = connection.get("#{self.class.path}/#{@attributes["Id"]}") @attributes['ContactIds'] = results.first['ContactIds'] end |