marty 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/marty.rb +12 -10
- data/lib/marty/rpc_call.rb +39 -0
- data/lib/marty/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86520af8c5b4d0f802cee4528502584f94d81eac
|
4
|
+
data.tar.gz: 1f6d2122fe80662c839ae2abd7fab0bc4512a1f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 88edfb46b139d22027b17a43573beb85d252415cfee6f0eea1028d166a38792bf964cab12c74a5adac38b1eee836097d85ad27ff69cf54ab8211ca3aac4e6a7c
|
7
|
+
data.tar.gz: 587c829255481f5c00b490ba7ff57c041289b928135951b1c7b2033a73d3c3e523a41c5d147f22a5bfefeef568dc4c9a9cc8290c46600acddc854620a50d035a
|
data/lib/marty.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
4
|
-
# would be any file that define a properly namespaced
|
5
|
-
# and that don't run code outside of
|
6
|
-
#
|
7
|
-
|
8
|
-
#
|
1
|
+
# DO NOT change order of require, since there are some dependencies
|
2
|
+
|
3
|
+
# DO NOT include anything here that will be properly autoloaded by
|
4
|
+
# Rails - This would be any file that define a properly namespaced
|
5
|
+
# module/class as Marty::<filename> and that don't run code outside of
|
6
|
+
# that module/class
|
7
|
+
|
8
|
+
# Also note that anything required here will need to require in any
|
9
|
+
# classes that they might be overriding methods in
|
9
10
|
|
10
11
|
require 'marty/engine'
|
11
12
|
require 'marty/railtie'
|
@@ -14,6 +15,7 @@ require 'marty/monkey'
|
|
14
15
|
require 'marty/promise_job'
|
15
16
|
require 'marty/lazy_column_loader'
|
16
17
|
|
17
|
-
# This does not get loaded in via bundler unless it is included in the
|
18
|
-
# Gemfile. Requiring it here removes the need to add it
|
18
|
+
# This does not get loaded in via bundler unless it is included in the
|
19
|
+
# application's Gemfile. Requiring it here removes the need to add it
|
20
|
+
# to the Gemfile
|
19
21
|
require 'net-ldap'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Marty::RpcCall
|
2
|
+
def self.marty_post(host, port, path, script, node, attrs, params)
|
3
|
+
http = Net::HTTP.new(host, port)
|
4
|
+
request = Net::HTTP::Post.new(path)
|
5
|
+
request.add_field('Content-Type', 'application/json')
|
6
|
+
request.body = {
|
7
|
+
"script" => script,
|
8
|
+
"node" => node,
|
9
|
+
"attrs" => attrs.to_json,
|
10
|
+
"params" => params.to_json,
|
11
|
+
}.to_json
|
12
|
+
begin
|
13
|
+
resraw = http.request(request)
|
14
|
+
rescue => e
|
15
|
+
raise "#{e.message} during RPC call to #{host}:#{port}"
|
16
|
+
end
|
17
|
+
res = JSON.parse(resraw.body)
|
18
|
+
raise res["error"] if res.is_a?(Hash) && !res["error"].blank?
|
19
|
+
res
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.xml_call(host, port, path, body, use_ssl)
|
23
|
+
http = Net::HTTP.new(host, port)
|
24
|
+
request = Net::HTTP::Post.new(path)
|
25
|
+
http.use_ssl = use_ssl
|
26
|
+
request.add_field('Content-Type', 'xml')
|
27
|
+
request.add_field('Accept', 'xml')
|
28
|
+
request.body = body
|
29
|
+
begin
|
30
|
+
resraw = http.request(request)
|
31
|
+
if resraw.class != Net::HTTPOK
|
32
|
+
raise "got #{resraw} during XML call"
|
33
|
+
end
|
34
|
+
rescue => e
|
35
|
+
raise "#{e.message} during RPC call to #{host}:#{port}#{path}"
|
36
|
+
end
|
37
|
+
resraw.body
|
38
|
+
end
|
39
|
+
end
|
data/lib/marty/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arman Bostani
|
@@ -14,7 +14,7 @@ authors:
|
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
|
-
date: 2016-09-
|
17
|
+
date: 2016-09-21 00:00:00.000000000 Z
|
18
18
|
dependencies:
|
19
19
|
- !ruby/object:Gem::Dependency
|
20
20
|
name: pg
|
@@ -450,6 +450,7 @@ files:
|
|
450
450
|
- lib/marty/promise_proxy.rb
|
451
451
|
- lib/marty/railtie.rb
|
452
452
|
- lib/marty/relation.rb
|
453
|
+
- lib/marty/rpc_call.rb
|
453
454
|
- lib/marty/util.rb
|
454
455
|
- lib/marty/version.rb
|
455
456
|
- lib/marty/xl.rb
|