eventql 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/eventql.gemspec +1 -1
- data/lib/eventql_client.rb +21 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58dc4ab3ef663108edc3189d5af8f5061d2d18d9
|
4
|
+
data.tar.gz: 9f05b602e1952dee5a49bbd3a778b8777bc84579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d64c2c60c255ac1eb6f0db122ad1e7b3fa28c89b69a57ce0fef212094daac33d64bc44514c28fc45c41e5060e25765b97b14ea6bc709a02be26b975eff05aef
|
7
|
+
data.tar.gz: 3a9182b2df50f3abd032ca8bc58512b2009ff144eb22cebf3ee445a00019b0eb165bc8ff4b1e3a87989979a53faf75b7a917481ad7516039049273cf86b35890
|
data/eventql.gemspec
CHANGED
data/lib/eventql_client.rb
CHANGED
@@ -10,6 +10,27 @@ class EventQL::Client
|
|
10
10
|
EventQL::Query.new(self, query_str, opts)
|
11
11
|
end
|
12
12
|
|
13
|
+
def insert!(data, opts = {})
|
14
|
+
request = Net::HTTP::Post.new("/api/v1/tables/insert")
|
15
|
+
request.add_field("Content-Type", "application/json")
|
16
|
+
|
17
|
+
if has_auth_token?
|
18
|
+
request.add_field("Authorization", "Token #{get_auth_token}")
|
19
|
+
end
|
20
|
+
|
21
|
+
request.body = data.to_json
|
22
|
+
puts request.body
|
23
|
+
|
24
|
+
http = Net::HTTP.new(get_host, get_port)
|
25
|
+
response = http.request(request)
|
26
|
+
|
27
|
+
if response.code.to_i == 201
|
28
|
+
return true
|
29
|
+
else
|
30
|
+
raise "HTTP ERROR (#{response.code}): #{response.body[0..128]}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
13
34
|
def get_host
|
14
35
|
return @opts[:host]
|
15
36
|
end
|