Sha256: 5210065255b68c86597f9f7be76c9a25f92e83899043b4f81377137a12838b00
Contents?: true
Size: 1.36 KB
Versions: 6
Compression:
Stored size: 1.36 KB
Contents
class Caren::ExternalMessage < Caren::Base def self.keys [ :id, # String (Caren message id) :person_name, # String (Andre Foeken) :external_person_id, # String (Your person id) :body, # Text :external_id, # String (Your message id) :in_reply_to_id, # Integer (Caren message id) :in_reply_to_type, # The type of message this is a reply to. (Always ExternalMessage if reply is set) :subject_id # Integer (Caren person id) ] end def create Caren::Api.post self.class.resource_url(self.subject_id), self.to_xml end def delete Caren::Api.delete self.class.resource_url(self.subject_id,self.id) end def self.array_root :external_messages end def self.node_root :external_message end def as_xml { :person_name => self.person_name, :external_person_id => self.external_person_id, :body => self.body, :external_id => self.external_id, :in_reply_to_id => self.in_reply_to_id } end def self.resource_location "/api/people/%i/external_messages/" end private def resource_url subject_id, id=nil self.class.resource_url(subject_id,id) end def self.resource_url subject_id, id=nil "#{Caren::Api.url}#{self.resource_location % subject_id}#{id}" end end
Version data entries
6 entries across 6 versions & 1 rubygems