Module: Arango::DocumentCollection::Importing

Defined in:
lib/arango/document_collection/importing.rb

Overview

Arango DocumentCollection Importing

Instance Method Summary collapse

Instance Method Details

#import(attributes:, values:, fromPrefix: nil, toPrefix: nil, overwrite: nil, wait_for_sync: nil, onDuplicate: nil, complete: nil, details: nil) ⇒ Object

maybe not



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/arango/document_collection/importing.rb', line 13

def import(attributes:, values:, fromPrefix: nil,
           toPrefix: nil, overwrite: nil, wait_for_sync: nil,
           onDuplicate: nil, complete: nil, details: nil)
  satisfy_category?(onDuplicate, [nil, "error", "update", "replace", "ignore"])
  satisfy_category?(overwrite, [nil, "yes", "true", true])
  satisfy_category?(complete, [nil, "yes", "true", true])
  satisfy_category?(details, [nil, "yes", "true", true])
  query = {
    collection:  @name,
    fromPrefix:  fromPrefix,
    toPrefix:    toPrefix,
    overwrite:   overwrite,
    waitForSync: wait_for_sync,
    onDuplicate: onDuplicate,
    complete:    complete,
    details:     details
  }
  body = "#{attributes}\n"
  values[0].is_a?(Array) ? values.each{|x| body += "#{x}\n"} : body += "#{values}\n"
  @database.request("POST", "_api/import", query: query, body: body)
end

#import_documentsObject

IMPORT ===



8
9
10
# File 'lib/arango/document_collection/importing.rb', line 8

def import_documents

end

#import_json(body:, type: "auto", fromPrefix: nil, toPrefix: nil, overwrite: nil, wait_for_sync: nil, onDuplicate: nil, complete: nil, details: nil) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/arango/document_collection/importing.rb', line 35

def import_json(body:, type: "auto", fromPrefix: nil,
                toPrefix: nil, overwrite: nil, wait_for_sync: nil,
                onDuplicate: nil, complete: nil, details: nil)
  satisfy_category?(type, %w[auto list documents])
  satisfy_category?(onDuplicate, [nil, "error", "update", "replace", "ignore"])
  satisfy_category?(overwrite, [nil, "yes", "true", true])
  satisfy_category?(complete, [nil, "yes", "true", true])
  satisfy_category?(details, [nil, "yes", "true", true])
  query = {
    collection:  @name,
    type:        type,
    fromPrefix:  fromPrefix,
    toPrefix:    toPrefix,
    overwrite:   overwrite,
    waitForSync: wait_for_sync,
    onDuplicate: onDuplicate,
    complete:    complete,
    details:     details
  }
  @database.request("POST", "_api/import", query: query,
                    body: body)
end