Sha256: 2d96517b9cb13a392f8c609b1aae9aefe8458f3710fc9f005df51dde2f7e31fd
Contents?: true
Size: 1 KB
Versions: 8
Compression:
Stored size: 1 KB
Contents
module FlexmlsApi 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 FlexmlsApi.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
8 entries across 8 versions & 2 rubygems