Sha256: 73cb66b408331576eed037258a88cfea27b0439a96b841a9ac20007333913b4d

Contents?: true

Size: 640 Bytes

Versions: 44

Compression:

Stored size: 640 Bytes

Contents

require 'restful_model'

module Inbox
  class File < RestfulModel

    parameter :size
    parameter :filename
    parameter :content_type
    parameter :is_embedded
    parameter :message_id

    # For uploading the file
    parameter :file

    def inflate(json)
      super
      content_type = json["content-type"] if json["content-type"]
    end

    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

  end
end

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
inbox-0.16.0 lib/file.rb
inbox-0.15.8 lib/file.rb
nylas-0.15.7d lib/file.rb
inbox-0.15.7d lib/file.rb
nylas-0.15.7c lib/file.rb
nylas-0.15.7b lib/file.rb
nylas-0.15.7 lib/file.rb
nylas-0.15.6 lib/file.rb
nylas-0.15.5 lib/file.rb
inbox-0.15.4 lib/file.rb
inbox-0.15.3 lib/file.rb
inbox-0.15.2 lib/file.rb
inbox-0.15.1 lib/file.rb
inbox-0.15.0 lib/file.rb
inbox-0.14.1 lib/file.rb
inbox-0.14.0 lib/file.rb
inbox-0.13.0 lib/file.rb
inbox-0.12.0 lib/file.rb
inbox-0.11.0 lib/file.rb
inbox-0.10.1 lib/file.rb