Class: Inbox::Message

Inherits:
RestfulModel show all
Defined in:
lib/message.rb

Direct Known Subclasses

Draft

Instance Method Summary collapse

Methods inherited from RestfulModel

#==, #as_json, collection_name, #destroy, #initialize, #save!, #update, #url

Methods included from TimeAttrAccessor

#time_attr_accessor

Methods included from Parameters

included, #parameters

Constructor Details

This class inherits a constructor from Inbox::RestfulModel

Instance Method Details

#filesObject



26
27
28
# File 'lib/message.rb', line 26

def files
  @files ||= RestfulModelCollection.new(File, @_api, @namespace_id, {:message_id=>@id})
end

#inflate(json) ⇒ Object



19
20
21
22
23
24
# File 'lib/message.rb', line 19

def inflate(json)
  super
  @to ||= []
  @cc ||= []
  @bcc ||= []
end

#rawObject



30
31
32
33
34
35
36
37
38
39
# File 'lib/message.rb', line 30

def raw
  model = nil
  collection = RestfulModelCollection.new(Message, @_api, @namespace_id, {:message_id=>@id})
  RestClient.get("#{collection.url}/#{id}/rfc2822"){ |response,request,result|
    json = Inbox.interpret_response(result, response, {:expected_class => Object})
    model = Rfc2822.new(@_api)
    model.inflate(json)
  }
  model
end