Sha256: d544984021f8991ddcb8c1e93ff5be3f96f230f71e2e3ffe6100b93958027ac0
Contents?: true
Size: 1020 Bytes
Versions: 73
Compression:
Stored size: 1020 Bytes
Contents
module SparkApi module Models class Note < Base extend Subresource self.element_name = "notes" # not sure this is really of any use... def self.get(options={}) ret = super(options) if ret.empty? return nil else return ret.first end end def save(arguments={}) begin return save!(arguments) rescue BadResourceRequest => e rescue NotFound => e # log and leave SparkApi.logger.error("Failed to save note #{self} (path: #{self.class.path}): #{e.message}") end false end def save!(args={}) args.merge(:Notes => attributes['Note']) results = connection.put(self.class.path, {:Note => attributes['Note']}, args) result = results.first attributes['ResourceUri'] = result['ResourceUri'] true end def delete(args={}) connection.delete(self.class.path, args) end end end end
Version data entries
73 entries across 73 versions & 1 rubygems