Sha256: 899a764dff05ef64e4e1259d16198eb6b49c90a8cb0d16e053e68e5902b1524b

Contents?: true

Size: 969 Bytes

Versions: 57

Compression:

Stored size: 969 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 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['Id'] = result['Id']
        attributes['Mode'] = result['Mode']
        attributes['ResourceUri'] = result['ResourceUri']
        attributes['SharedUri'] = result['SharedUri']
        true
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
spark_api-1.6.3 lib/spark_api/models/shared_listing.rb
spark_api-1.6.2 lib/spark_api/models/shared_listing.rb
spark_api-1.6.1 lib/spark_api/models/shared_listing.rb
spark_api-1.5.7 lib/spark_api/models/shared_listing.rb
spark_api-1.6.0 lib/spark_api/models/shared_listing.rb
spark_api-1.5.6 lib/spark_api/models/shared_listing.rb
spark_api-1.5.5 lib/spark_api/models/shared_listing.rb
spark_api-1.5.4 lib/spark_api/models/shared_listing.rb
spark_api-1.5.3 lib/spark_api/models/shared_listing.rb
spark_api-1.5.2 lib/spark_api/models/shared_listing.rb
spark_api-1.5.1 lib/spark_api/models/shared_listing.rb
spark_api-1.5.0 lib/spark_api/models/shared_listing.rb
spark_api-1.4.34 lib/spark_api/models/shared_listing.rb
spark_api-1.4.32 lib/spark_api/models/shared_listing.rb
spark_api-1.4.31 lib/spark_api/models/shared_listing.rb
spark_api-1.4.29 lib/spark_api/models/shared_listing.rb
spark_api-1.4.28 lib/spark_api/models/shared_listing.rb
spark_api-1.4.27 lib/spark_api/models/shared_listing.rb
spark_api-1.4.26 lib/spark_api/models/shared_listing.rb
spark_api-1.4.25 lib/spark_api/models/shared_listing.rb