Sha256: 385088d1c2efb2b516184ac3fa486e2dfcc6dbc140019cd58d17a399b2c00453

Contents?: true

Size: 631 Bytes

Versions: 7

Compression:

Stored size: 631 Bytes

Contents

require 'restful_model'

module Inbox
  class Draft < Message

    parameter :thread_id
    parameter :version
    parameter :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

7 entries across 7 versions & 1 rubygems

Version Path
inbox-0.12.0 lib/draft.rb
inbox-0.11.0 lib/draft.rb
inbox-0.10.1 lib/draft.rb
inbox-0.10.0 lib/draft.rb
inbox-0.9.0 lib/draft.rb
inbox-0.8.1 lib/draft.rb
inbox-0.8.0 lib/draft.rb