Class: SparkApi::Models::SharedListing
- Extended by:
- Finders
- Defined in:
- lib/spark_api/models/shared_listing.rb
Constant Summary
Constants included from Paginate
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #ListingIds=(listing_ids) ⇒ Object
- #save(arguments = {}) ⇒ Object
- #save!(arguments = {}) ⇒ Object
- #ViewId=(id) ⇒ Object
Methods included from Finders
Methods inherited from Base
connection, #connection, count, element_name, element_name=, first, get, #id, #initialize, #load, #method_missing, #parse_id, path, #path, #persisted?, prefix, prefix=, #resource_pluralized, #resource_uri, #respond_to?, #to_param, #to_partial_path
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
Instance Method Details
#ListingIds=(listing_ids) ⇒ Object
7 8 9 |
# File 'lib/spark_api/models/shared_listing.rb', line 7 def ListingIds=(listing_ids) attributes["ListingIds"] = Array(listing_ids) end |
#save(arguments = {}) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/spark_api/models/shared_listing.rb', line 14 def save(arguments={}) begin return save!(arguments) rescue BadResourceRequest => e rescue NotFound => e # log and leave SparkApi.logger.error("Failed to save SharedListing #{self}: #{e.}") end false end |
#save!(arguments = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/spark_api/models/shared_listing.rb', line 24 def save!(arguments={}) results = connection.post self.class.path, attributes, arguments result = results.first attributes['Id'] = result['Id'] attributes['Mode'] = result['Mode'] attributes['ResourceUri'] = result['ResourceUri'] attributes['SharedUri'] = result['SharedUri'] true end |
#ViewId=(id) ⇒ Object
10 11 12 |
# File 'lib/spark_api/models/shared_listing.rb', line 10 def ViewId=(id) attributes["ViewId"] = id end |