Module: Gnouch

Defined in:
lib/gnouch.rb,
lib/gnouch/error.rb,
lib/gnouch/design.rb,
lib/gnouch/server.rb,
lib/gnouch/database.rb,
lib/gnouch/requestor.rb,
lib/gnouch/attachment.rb

Defined Under Namespace

Modules: Design Classes: Database, Error, Requestor, Server

Class Method Summary collapse

Class Method Details

.adapter(adapter) ⇒ Object



7
8
9
# File 'lib/gnouch.rb', line 7

def self.adapter(adapter)
  Requestor.send :include, adapter
end

.add_inline_attachment(doc, name, mime, data) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/gnouch/attachment.rb', line 5

def self.add_inline_attachment(doc, name, mime, data)
  attachment = {
    :content_type => mime,
    :data => Base64.urlsafe_encode64(data)
  }
  attachments = doc["_attachments"]
  unless attachments
    attachments = {}
    doc["_attachments"] = attachments
  end
  attachments[name] = attachment
end