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.4.2 lib/spark_api/models/shared_listing.rb
spark_api-1.4.1 lib/spark_api/models/shared_listing.rb
spark_api-1.4.0 lib/spark_api/models/shared_listing.rb
spark_api-1.3.28 lib/spark_api/models/shared_listing.rb
spark_api-1.3.27 lib/spark_api/models/shared_listing.rb
spark_api-1.3.26 lib/spark_api/models/shared_listing.rb
spark_api-1.3.25 lib/spark_api/models/shared_listing.rb
spark_api-1.3.24 lib/spark_api/models/shared_listing.rb
spark_api-1.3.23 lib/spark_api/models/shared_listing.rb
spark_api-1.3.21 lib/spark_api/models/shared_listing.rb
spark_api-1.3.20 lib/spark_api/models/shared_listing.rb
spark_api-1.3.19 lib/spark_api/models/shared_listing.rb
spark_api-1.3.18 lib/spark_api/models/shared_listing.rb
spark_api-1.3.17 lib/spark_api/models/shared_listing.rb
spark_api-1.3.16 lib/spark_api/models/shared_listing.rb
spark_api-1.3.15 lib/spark_api/models/shared_listing.rb
spark_api-1.3.14 lib/spark_api/models/shared_listing.rb