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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f7ab7a282240ba4ee18dc965f93bdb5dc90dda4
4
- data.tar.gz: 59917c67864d40e9d849695798b11fc650c2b060
3
+ metadata.gz: 86520af8c5b4d0f802cee4528502584f94d81eac
4
+ data.tar.gz: 1f6d2122fe80662c839ae2abd7fab0bc4512a1f4
5
5
  SHA512:
6
- metadata.gz: 56e52e10fad378a499de7debcc9528dcc1127f16a8802e907333d9d65ea7aab3320a8b53042e99ac16f1a354cc9359d8d14c99d690693fa5d4d67a2ef8609ef1
7
- data.tar.gz: 5e38cb0f66dcdec946da7ca79ff44de3f0c60bc68a6982a81e1e8961b0c396a3d92a480fac9e96f51df10c24e0ab01e842c52390b7341859db921e455caff06a
6
+ metadata.gz: 88edfb46b139d22027b17a43573beb85d252415cfee6f0eea1028d166a38792bf964cab12c74a5adac38b1eee836097d85ad27ff69cf54ab8211ca3aac4e6a7c
7
+ data.tar.gz: 587c829255481f5c00b490ba7ff57c041289b928135951b1c7b2033a73d3c3e523a41c5d147f22a5bfefeef568dc4c9a9cc8290c46600acddc854620a50d035a
data/lib/marty.rb CHANGED
@@ -1,11 +1,12 @@
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 Rails - This
4
- # would be any file that define a properly namespaced module/class as Marty::<filename>
5
- # and that don't run code outside of that module/class
6
- #
7
- # Also note that anything required here will need to require in any classes that
8
- # they might be overriding methods in
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 application's
18
- # Gemfile. Requiring it here removes the need to add it to the Gemfile
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
@@ -1,3 +1,3 @@
1
1
  module Marty
2
- VERSION = "1.0.9"
2
+ VERSION = "1.0.10"
3
3
  end
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.9
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-19 00:00:00.000000000 Z
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