Sha256: 89ea67c97af48274716422c1fa49db7e880415f0fdd2558b7355b061b01c7806
Contents?: true
Size: 1.22 KB
Versions: 3
Compression:
Stored size: 1.22 KB
Contents
module FlexmlsApi module Models class Contact < Base extend Finders self.element_name="contacts" def save(arguments={}) begin return save!(arguments) rescue NotFound, BadResourceRequest => e FlexmlsApi.logger.error("Failed to save resource #{self}: #{e.message}") end false end def save!(arguments={}) results = connection.post self.class.path, {"Contacts" => [ attributes ], "Notify" => notify? }, arguments result = results.first attributes['ResourceUri'] = result['ResourceUri'] attributes['Id'] = parse_id(result['ResourceUri']) true end def self.by_tag(tag_name, arguments={}) collect(connection.get("#{path}/tags/#{tag_name}", arguments)) end def self.tags(arguments={}) connection.get("#{path}/tags", arguments) end def self.my(arguments={}) new(connection.get('/my/contact', arguments).first) end # Notify the agent of contact creation via a flexmls message. def notify? @notify == true end def notify=(notify_me=true) @notify = notify_me end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
flexmls_api-0.7.0 | lib/flexmls_api/models/contact.rb |
flexmls_api-0.6.5 | lib/flexmls_api/models/contact.rb |
flexmls_api-0.6.4 | lib/flexmls_api/models/contact.rb |