arii 1.1 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/arii.gemspec +2 -0
- data/lib/arii/agent.rb +51 -44
- data/lib/arii/csvdetector.rb +1 -1
- data/lib/arii/version.rb +1 -1
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46bd94c23d38c60e86cb59d895a3a055f5156542
|
4
|
+
data.tar.gz: f0ee9fc3475dc2a63bbcd6f2389302650936c2d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ad68f3de32c472f75c6e69404e738c1c90a83891bb5d5665dfdb08fa5b3153a41e8e586eda1a15088733f573f3ef9b26b1b9e437fbe5421d0a52fae29f08c6a
|
7
|
+
data.tar.gz: b50c8411dc3f10c15833a846a7cbb0aae3ec1f4a568ab61c2fcbe33b92a1afc9ab099e19978d78279e6027b8c75d10977843a6fd63419fbfb12b0b86d9d650e3
|
data/arii.gemspec
CHANGED
@@ -22,5 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_runtime_dependency 'rest-client', '~> 0'
|
24
24
|
spec.add_runtime_dependency 'nokogiri'
|
25
|
+
spec.add_runtime_dependency 'rubyXL'
|
26
|
+
spec.add_runtime_dependency 'spreadsheet'
|
25
27
|
spec.add_runtime_dependency 'jsonpath', '~> 0'
|
26
28
|
end
|
data/lib/arii/agent.rb
CHANGED
@@ -41,6 +41,13 @@ module ARII
|
|
41
41
|
@response = {:status => 400, :error => e}
|
42
42
|
ARII::Config.log.error(self.class.name) {"#{e}"}
|
43
43
|
end
|
44
|
+
when 'excel'
|
45
|
+
begin
|
46
|
+
@d = ARII::ExcelDetector.new(self)
|
47
|
+
rescue Exception => e
|
48
|
+
@response = {:status => 400, :error => e}
|
49
|
+
ARII::Config.log.error(self.class.name) {"#{e}"}
|
50
|
+
end
|
44
51
|
when 'xml'
|
45
52
|
begin
|
46
53
|
@d = ARII::XMLDetector.new(self)
|
@@ -58,62 +65,62 @@ module ARII
|
|
58
65
|
end
|
59
66
|
|
60
67
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
@checkup = @d.checkup
|
67
|
-
rescue Exception => e
|
68
|
-
ARII::Config.log.error(self.class.name) {"Checkup error: #{e}"}
|
68
|
+
# Start checkup
|
69
|
+
begin
|
70
|
+
unless content.nil? then
|
71
|
+
@d.content = content
|
69
72
|
end
|
73
|
+
@checkup = @d.checkup
|
74
|
+
rescue Exception => e
|
75
|
+
ARII::Config.log.error(self.class.name) {"Checkup error: #{e}"}
|
76
|
+
end
|
70
77
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
@checkup[:templates] = @d.templates.uniq
|
78
|
-
rescue Exception => e
|
79
|
-
ARII::Config.log.error(self.class.name) {"Detection error: #{e}"}
|
78
|
+
# Start detection
|
79
|
+
begin
|
80
|
+
@d.objects.each do |object|
|
81
|
+
@d.detect object
|
80
82
|
end
|
81
83
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
84
|
+
@checkup[:templates] = @d.templates.uniq
|
85
|
+
rescue Exception => e
|
86
|
+
ARII::Config.log.error(self.class.name) {"Detection error: #{e}"}
|
87
|
+
end
|
88
|
+
|
89
|
+
begin
|
90
|
+
if @checkup[:status] == 100 then
|
91
|
+
process @checkup
|
88
92
|
end
|
89
|
-
|
93
|
+
rescue Exception => e
|
94
|
+
ARII::Config.log.error(self.class.name) {"Process error: #{e}"}
|
90
95
|
end
|
96
|
+
response = {:status => @checkup[:status], :message => "[ARII][Checkup][execute] All OK."}
|
97
|
+
end
|
91
98
|
|
92
99
|
|
93
100
|
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
end
|
101
|
+
##
|
102
|
+
# => Process agent checks.
|
103
|
+
#
|
104
|
+
def process checkup
|
105
|
+
begin
|
106
|
+
checkup[:templates].each do |template|
|
107
|
+
ARII::Config.log.info(self.class.name) {"Delivering to #{template} template."}
|
108
|
+
checkup[:payload].each do |payload|
|
109
|
+
ARII::Config.log.debug(self.class.name) {"Processing #{payload}."}
|
110
|
+
response = RestClient.post "#{ARII::Config.host}postman/deliver/#{template}.js", payload
|
111
|
+
case response.code
|
112
|
+
when 200
|
113
|
+
ARII::Config.log.debug(self.class.name) {"Delivered to #{template}."}
|
114
|
+
else
|
115
|
+
ARII::Config.log.warn(self.class.name) {"unable to deliver \"#{payload}\" to \"#{template}\""}
|
110
116
|
end
|
111
117
|
end
|
112
|
-
rescue Exception => e
|
113
|
-
ARII::Config.log.error(self.class.name) {"Processing error: #{e}"}
|
114
118
|
end
|
115
|
-
|
119
|
+
rescue Exception => e
|
120
|
+
ARII::Config.log.error(self.class.name) {"Processing error: #{e}"}
|
116
121
|
end
|
122
|
+
|
117
123
|
end
|
124
|
+
end
|
118
125
|
|
119
|
-
|
126
|
+
end
|
data/lib/arii/csvdetector.rb
CHANGED
data/lib/arii/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arii
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Lopes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,34 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubyXL
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: spreadsheet
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
69
97
|
- !ruby/object:Gem::Dependency
|
70
98
|
name: jsonpath
|
71
99
|
requirement: !ruby/object:Gem::Requirement
|