gremlin_client 0.0.3 → 0.0.4

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: d8aacf727c3233d7f671c378b395b0ac382b3918
4
- data.tar.gz: e6b39121f3d570b622c1917590a64c285999c261
3
+ metadata.gz: 1b115f8790e0e39186f7d9d2f940e78cebe26f50
4
+ data.tar.gz: d3b354fb424d8d24805e7f91a97a9e1e610b9251
5
5
  SHA512:
6
- metadata.gz: ed5208053eab26bbcc9cd225589479ea78227181b7cb08a99b1f75f5cd33feb767a2037ac17512cb109ac9958a4298da7e0073abddc021c4ffde53c13ca04616
7
- data.tar.gz: c7ccee5ce8f570bb8dfcbedda1c1496fbce69151a51d0fd12e64c50e3008a7294e91f2309ef9c37fc8b0b8e7666a69eb7cac25a3e57c42ea8b607c9773ef2e91
6
+ metadata.gz: 968658a02d4647d0d49d03530d4f0aaa7830d76807337229673f5aeaec30d9898f936d095b0ff908b087b6c1e69bc5335599a1254326ee18f687a09c2d7a4ee8
7
+ data.tar.gz: 74060237829bc7fef5562efa39968d6fde683ac222742cb6b3ead2228c98459adb4015fd7a65387e5ece564a72b26ac38a42b15c80f33778f3eb781515654429
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gremlin_client (0.0.3)
4
+ gremlin_client (0.0.4)
5
5
  websocket-client-simple (~> 0.3)
6
6
 
7
7
  GEM
@@ -6,10 +6,14 @@ require 'gremlin_client'
6
6
 
7
7
  conn = GremlinClient::Connection.new(groovy_script_path: 'example/scripts')
8
8
 
9
+
10
+ pp conn.send_file('concierge_scores.groovy', {fincUserId: 260607, contentTypeFilter: ['Try::Beauty']})
11
+
9
12
  pp conn.send('1+what', {what: 10})
10
13
 
11
- pp conn.send('g.V().count()')
14
+ pp conn.send('g.V().next()')
12
15
 
13
16
  pp conn.send_file('test.groovy', {what: Time.now.to_i})
14
17
 
18
+
15
19
  conn.close
@@ -5,6 +5,21 @@ module GremlinClient
5
5
 
6
6
  attr_reader :timeout, :groovy_script_path
7
7
 
8
+ STATUS = {
9
+ success: 200,
10
+ no_content: 204,
11
+ partial_content: 206,
12
+
13
+ unauthorized: 401,
14
+ authenticate: 407,
15
+ malformed_request: 498,
16
+ invalid_request_arguents: 499,
17
+ server_error: 500,
18
+ script_evaluation_error: 597,
19
+ server_timeout: 598,
20
+ server_serialization_error: 599
21
+ }
22
+
8
23
  class << self
9
24
  # a centralized place for you to store a connection pool of those objects
10
25
  # recommendeded one is: https://github.com/mperham/connection_pool
@@ -101,7 +116,10 @@ module GremlinClient
101
116
  # we validate our response here to make sure it is going to be
102
117
  # raising exceptions in the right thread
103
118
  def parse_response
104
- unless @response['status']['code'] == 200
119
+ # note that the partial_content status should be processed differently.
120
+ # look at http://tinkerpop.apache.org/docs/3.0.1-incubating/ for more info
121
+ ok_status = [:success, :no_content, :partial_content].map { |st| STATUS[st] }
122
+ unless ok_status.include?(@response['status']['code'])
105
123
  fail ::GremlinClient::ServerError.new(@response['status']['code'], @response['status']['message'])
106
124
  end
107
125
  @response['result']
@@ -1,3 +1,3 @@
1
1
  module GremliClient
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gremlin_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcelo Coraça de Freitas