Class: Zillabyte::API::Data

Inherits:
Base
  • Object
show all
Defined in:
lib/zillabyte/api/data.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize, #request

Constructor Details

This class inherits a constructor from Zillabyte::API::Base

Instance Method Details

#append(id, options = {}) ⇒ Object

POST /datasets/1/append



83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/zillabyte/api/data.rb', line 83

def append(id, options = {})
  
  res = @api.request(
    :expects  => 200,
    :method   => :post,
    :path     => "/relations/#{CGI.escape(id)}/append",
    # :headers  => {"Content-Type" => "application/octet-stream"},
    :body     => options.to_json
  )
  hash = res.body
  hash
 
end

#create(name, options = {}) ⇒ Object

POST /datasets



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/zillabyte/api/data.rb', line 48

def create(name, options = {})
  
  options = {
    :name => name,
    # rows
    # schema
    # relations
  }.merge(options)

  res = @api.request(
    :expects  => 200,
    :method   => :post,
    :path     => "/relations",
    :body     => options.to_json
  )

  res.body
  
end

#delete(id, options = {}) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/zillabyte/api/data.rb', line 69

def delete(id, options={})
  
  res = @api.request(
    :expects => 200,
    :method  => :delete,
    :path    => "/relations/#{CGI.escape(id)}",
    :body    => options.to_json
  )

  res.body
end

#get(id, options = {}) ⇒ Object

GET /datasets/1



6
7
8
9
10
11
12
13
14
# File 'lib/zillabyte/api/data.rb', line 6

def get(id, options = {})
  res = @api.request(
    :expects  => 200,
    :method   => :get,
    :path     => "/relations/#{CGI.escape(id)}",
    :body     => options.to_json 
  )
  res.body
end

#pull(id, options = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/zillabyte/api/data.rb', line 27

def pull(id, options = {})
  res = @api.request(
    :expects  => 200,
    :method   => :post,
    :path     => "/relations/#{CGI.escape(id)}/pull",
    :body     => options.to_json 
  )
  res.body
end

#pull_to_s3(id, options) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/zillabyte/api/data.rb', line 37

def pull_to_s3(id, options)
  res = @api.request(
    :expects => 200,
    :method  => :post,
    :path    => "/relations/#{CGI.escape(id)}/pull_to_s3",
    :body    => options.to_json
  )
  res.body
end

#show(id, method, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/zillabyte/api/data.rb', line 16

def show(id, method, options = {})
  res = @api.request(
    :expects  => 200,
    :method   => method,
    :path     => "/relations/#{CGI.escape(id)}/samples",
    :body     => options.to_json
  )

  res.body
end