Sha256: 919d1d7672d9fd724b3695feb629707490570c98ef73c7b2a9043f494dacbb62

Contents?: true

Size: 679 Bytes

Versions: 25

Compression:

Stored size: 679 Bytes

Contents

require 'restful_model'

module Inbox
  class Draft < Message

    parameter :thread_id
    parameter :version
    parameter :reply_to_message_id

    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

25 entries across 25 versions & 2 rubygems

Version Path
inbox-0.18.0 lib/draft.rb
nylas-0.18.0 lib/draft.rb
nylas-0.17.4 lib/draft.rb
inbox-0.17.4 lib/draft.rb
inbox-0.17.3 lib/draft.rb
inbox-0.17.2 lib/draft.rb
nylas-0.17.2 lib/draft.rb
inbox-0.17.1 lib/draft.rb
nylas-0.17.1 lib/draft.rb
nylas-0.17.0 lib/draft.rb
inbox-0.17.0 lib/draft.rb
inbox-0.16.1 lib/draft.rb
nylas-0.16.1 lib/draft.rb
nylas-0.16.0 lib/draft.rb
inbox-0.16.0 lib/draft.rb
inbox-0.15.8 lib/draft.rb
nylas-0.15.7d lib/draft.rb
inbox-0.15.7d lib/draft.rb
nylas-0.15.7c lib/draft.rb
nylas-0.15.7b lib/draft.rb