pvoutput 0.3.0 → 0.4.0
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/.rubocop.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/lib/pvoutput/client.rb +19 -3
- data/lib/pvoutput/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd666b46f2d458278fa5cc61a27098d80c4598ec
|
4
|
+
data.tar.gz: 65282209af3a86141553ad69ea734f6a71e19b83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4763db564c14712d118676a008aea7a0e5d7d2c35b4ce4b04266766924df7e6d3bfc3c22ba896e169872ae249d08fd499edbae1a3457fb123cae923fd14d8a9e
|
7
|
+
data.tar.gz: 4fa1bd913875d28af09952b240aa9251c91bf6189bb672e426e80aa7c1dbc09e8cdc64480c5c3a54cd959793900adefc73c9fee1f49453c936fbd32fe2c61dde
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/pvoutput/client.rb
CHANGED
@@ -17,6 +17,24 @@ module PVOutput
|
|
17
17
|
self.class.headers 'X-Pvoutput-Apikey' => @api_key, 'X-Pvoutput-SystemId' => @system_id
|
18
18
|
end
|
19
19
|
|
20
|
+
# Helper method to post batch request to pvout that retries at the moment we get
|
21
|
+
# a 400 error back with body containing 'Load in progress'
|
22
|
+
def post_request(path, options = {}, &block)
|
23
|
+
loop do
|
24
|
+
response = self.class.post(path, options, &block)
|
25
|
+
|
26
|
+
if response.code == 400 && response.body =~ /Load in progress/
|
27
|
+
# We can't send data too fast, when the previous request is still loaded we
|
28
|
+
# have to wait so sleep 10 seconds and try again
|
29
|
+
sleep(10)
|
30
|
+
elsif response.code == 200
|
31
|
+
return
|
32
|
+
else
|
33
|
+
raise('Bad Post')
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
20
38
|
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
21
39
|
def add_status(options)
|
22
40
|
time = options[:when] || Time.now
|
@@ -84,9 +102,7 @@ module PVOutput
|
|
84
102
|
:data => data.chop,
|
85
103
|
}
|
86
104
|
|
87
|
-
|
88
|
-
|
89
|
-
raise('Bad Post') unless response.code == 200
|
105
|
+
post_request('/service/r2/addbatchoutput.jsp', :body => params)
|
90
106
|
end
|
91
107
|
end
|
92
108
|
# rubocop:enable Metrics/AbcSize
|
data/lib/pvoutput/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pvoutput
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Ferlito
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -207,7 +207,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
207
|
version: '0'
|
208
208
|
requirements: []
|
209
209
|
rubyforge_project:
|
210
|
-
rubygems_version: 2.
|
210
|
+
rubygems_version: 2.5.1
|
211
211
|
signing_key:
|
212
212
|
specification_version: 4
|
213
213
|
summary: Library to speak to the PVOutput API
|