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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcfe032cca875fd4c881d0d58d8e05daa3200cb2
4
- data.tar.gz: 61de5b1da00f8824032837e3d352c5efef515f99
3
+ metadata.gz: 58dc4ab3ef663108edc3189d5af8f5061d2d18d9
4
+ data.tar.gz: 9f05b602e1952dee5a49bbd3a778b8777bc84579
5
5
  SHA512:
6
- metadata.gz: 087c4216a70732986b0ea9dde580baa027acb306daac33f689b3384e3ac93828dd4f20d45c5577ab15955075837b86afc8a28835572e4f0a9326db84fc7bf88f
7
- data.tar.gz: 8136fa14c1eb1d714718fc455ae147e6c124d2cd0904f400367e9ef15c7aac806b2468ba48e6b55910e11d83467fca7a50ad32291f12bd4606eabc4cae27321b
6
+ metadata.gz: 8d64c2c60c255ac1eb6f0db122ad1e7b3fa28c89b69a57ce0fef212094daac33d64bc44514c28fc45c41e5060e25765b97b14ea6bc709a02be26b975eff05aef
7
+ data.tar.gz: 3a9182b2df50f3abd032ca8bc58512b2009ff144eb22cebf3ee445a00019b0eb165bc8ff4b1e3a87989979a53faf75b7a917481ad7516039049273cf86b35890
data/eventql.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "eventql"
3
- s.version = "0.0.2"
3
+ s.version = "0.0.3"
4
4
  s.authors = ["Paul Asmuth"]
5
5
  s.date = "2016-12-18"
6
6
  s.description = "EventQL ruby driver"
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eventql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Asmuth