Class: Inbox::File
- Inherits:
-
RestfulModel
- Object
- RestfulModel
- Inbox::File
- Defined in:
- lib/file.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#file ⇒ Object
For uploading the file.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#is_embedded ⇒ Object
Returns the value of attribute is_embedded.
-
#message_id ⇒ Object
Returns the value of attribute message_id.
-
#size ⇒ Object
Returns the value of attribute size.
Attributes inherited from RestfulModel
#created_at, #id, #namespace_id
Instance Method Summary collapse
Methods inherited from RestfulModel
#==, #as_json, collection_name, #destroy, #initialize, #update, #url
Constructor Details
This class inherits a constructor from Inbox::RestfulModel
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
8 9 10 |
# File 'lib/file.rb', line 8 def content_type @content_type end |
#file ⇒ Object
For uploading the file
13 14 15 |
# File 'lib/file.rb', line 13 def file @file end |
#filename ⇒ Object
Returns the value of attribute filename.
7 8 9 |
# File 'lib/file.rb', line 7 def filename @filename end |
#is_embedded ⇒ Object
Returns the value of attribute is_embedded.
9 10 11 |
# File 'lib/file.rb', line 9 def @is_embedded end |
#message_id ⇒ Object
Returns the value of attribute message_id.
10 11 12 |
# File 'lib/file.rb', line 10 def @message_id end |
#size ⇒ Object
Returns the value of attribute size.
6 7 8 |
# File 'lib/file.rb', line 6 def size @size end |
Instance Method Details
#inflate(json) ⇒ Object
15 16 17 18 |
# File 'lib/file.rb', line 15 def inflate(json) super content_type = json["content-type"] if json["content-type"] end |
#save! ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/file.rb', line 20 def save! ::RestClient.post(url, {:file => @file}) do |response, request, result| json = Inbox.interpret_response(result, response, :expected_class => Object) json = json[0] if (json.class == Array) inflate(json) end self end |