Class: Inbox::File

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

Instance Method Summary collapse

Methods inherited from RestfulModel

#==, #as_json, collection_name, #destroy, #initialize, #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

#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