Sha256: 000287122c606c96e1fceb2252cf8f91de51d5e15b596c579bd46898df172277

Contents?: true

Size: 901 Bytes

Versions: 16

Compression:

Stored size: 901 Bytes

Contents

module SparkApi
  module Models
    class SharedListing < Base 
      extend Finders
      self.element_name="sharedlistings"
      
      def ListingIds=(listing_ids)
        attributes["ListingIds"] = Array(listing_ids)
      end
      def ViewId=(id)
        attributes["ViewId"] = id
      end
      def ReportId=(id)
        attributes["ReportId"] = id
      end
      
      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.message}")
        end
        false
      end
      def save!(arguments={})
        results = connection.post self.class.path, attributes, arguments
        result = results.first
        attributes['ResourceUri'] = result['ResourceUri']
        true
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
spark_api-1.3.13 lib/spark_api/models/shared_listing.rb
spark_api-1.3.10 lib/spark_api/models/shared_listing.rb
spark_api-1.3.9 lib/spark_api/models/shared_listing.rb
spark_api-1.3.6 lib/spark_api/models/shared_listing.rb
spark_api-1.3.3 lib/spark_api/models/shared_listing.rb
spark_api-1.3.1 lib/spark_api/models/shared_listing.rb
spark_api-1.3.0 lib/spark_api/models/shared_listing.rb
spark_api-1.2.1 lib/spark_api/models/shared_listing.rb
spark_api-1.2.0 lib/spark_api/models/shared_listing.rb
spark_api-1.1.2 lib/spark_api/models/shared_listing.rb
spark_api-1.1.1 lib/spark_api/models/shared_listing.rb
spark_api-1.1.0 lib/spark_api/models/shared_listing.rb
spark_api-1.0.4 lib/spark_api/models/shared_listing.rb
spark_api-1.0.2 lib/spark_api/models/shared_listing.rb
spark_api-1.0.1 lib/spark_api/models/shared_listing.rb
spark_api-1.0.0 lib/spark_api/models/shared_listing.rb