Sha256: 8785fd156d4017d6e7e4a84d37008b7abdad1ed07dd53888f83bc767dc9a1812

Contents?: true

Size: 605 Bytes

Versions: 5

Compression:

Stored size: 605 Bytes

Contents

require 'restful_model'

module Inbox
  class Draft < Message

    attr_accessor :thread_id
    attr_accessor :version
    attr_accessor :state

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

    def send!
      save! unless @id

      url = @_api.url_for_path("/n/#{@namespace_id}/send")
      data = {:draft_id => @id, :version => @version}

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

      self
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
inbox-0.5.0 lib/draft.rb
inbox-0.4.4 lib/draft.rb
inbox-0.4.3 lib/draft.rb
inbox-0.4.2 lib/draft.rb
inbox-0.4.1 lib/draft.rb