Sha256: 49c928430fc7edac321a60ce604c2101926500463f7e90c2826926f0298a51c0

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 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!
      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|
        Inbox.interpret_response(result, response, :expected_class => Object)
      end

      self
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
inbox-0.7.0 lib/draft.rb