gremlin_client 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/example/test.rb +5 -1
- data/lib/gremlin_client/connection.rb +19 -1
- data/lib/gremlin_client/version.rb +1 -1
- 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: 1b115f8790e0e39186f7d9d2f940e78cebe26f50
|
4
|
+
data.tar.gz: d3b354fb424d8d24805e7f91a97a9e1e610b9251
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 968658a02d4647d0d49d03530d4f0aaa7830d76807337229673f5aeaec30d9898f936d095b0ff908b087b6c1e69bc5335599a1254326ee18f687a09c2d7a4ee8
|
7
|
+
data.tar.gz: 74060237829bc7fef5562efa39968d6fde683ac222742cb6b3ead2228c98459adb4015fd7a65387e5ece564a72b26ac38a42b15c80f33778f3eb781515654429
|
data/Gemfile.lock
CHANGED
data/example/test.rb
CHANGED
@@ -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().
|
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
|
-
|
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']
|