Sha256: ed5d72929a5bedecbae4ad008d3e2341656633ec7c3cfde45ee5a16be275b450

Contents?: true

Size: 644 Bytes

Versions: 5

Compression:

Stored size: 644 Bytes

Contents

require 'restful_model'

module Inbox
  class Draft < Message

    parameter :thread_id
    parameter :version

    def attach(file)
      file.save! unless file.id
      @file_ids.push(file.id)
    end

    def send!
      url = @_api.url_for_path("/n/#{@namespace_id}/send")
      if @id
        data = {:draft_id => @id, :version => @version}
      else
        data = as_json()
      end

      ::RestClient.post(url, data.to_json, :content_type => :json) do |response, request, result|
        json = Inbox.interpret_response(result, response, :expected_class => Object)
        self.inflate(json)
      end

      self
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inbox-0.15.2 lib/draft.rb
inbox-0.15.1 lib/draft.rb
inbox-0.15.0 lib/draft.rb
inbox-0.14.1 lib/draft.rb
inbox-0.14.0 lib/draft.rb