dogapi 1.14.0 → 1.15.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  Changes
2
2
  =======
3
+ # 1.15.0 / 2015-02-03
4
+ * Encode capistrano output messages to UTF-8 before manipulating them. (thanks [@byroot][] [#52](https://github.com/DataDog/dogapi-rb/pull/52))
5
+ * Add open_timeout to avoid stuck HTTP calls (thanks [@Kaixiang][] [#55](https://github.com/DataDog/dogapi-rb/pull/55))
6
+
3
7
  # 1.14.0 / 2015-01-09
4
8
  * Add get_all_screenboards [#61](https://github.com/DataDog/dogapi-rb/pull/61)
5
9
  * Remove required start argument from schedule_downtime [#60](https://github.com/DataDog/dogapi-rb/pull/60)
@@ -99,3 +103,5 @@ Changes
99
103
  [@ansel1]: https://github.com/ansel1
100
104
  [@arielo]: https://github.com/arielo
101
105
  [@treeder]: https://github.com/treeder
106
+ [@Kaixiang]: https://github.com/Kaixiang
107
+ [@byroot]: https://github.com/byroot
@@ -92,7 +92,7 @@ module Capistrano
92
92
  message_content = (@logging_output[name] || []).join('')
93
93
  message = if !message_content.empty? then
94
94
  # Strip out color control characters
95
- message_content = message_content.gsub(/\e\[(\d+)m/, '')
95
+ message_content = sanitize_encoding(message_content).gsub(/\e\[(\d+)m/, '')
96
96
  "@@@\n#{message_content}@@@" else "" end
97
97
 
98
98
  Dogapi::Event.new(message,
@@ -105,6 +105,11 @@ module Capistrano
105
105
  )
106
106
  end
107
107
  end
108
+
109
+ def sanitize_encoding(string)
110
+ return string unless defined?(::Encoding) && string.encoding == Encoding::BINARY
111
+ string.encode(Encoding::UTF_8, Encoding::BINARY, invalid: :replace, undef: :replace, replace: '')
112
+ end
108
113
  end
109
114
 
110
115
  end
data/lib/dogapi/common.rb CHANGED
@@ -92,6 +92,7 @@ module Dogapi
92
92
 
93
93
  uri = URI.parse(@api_host)
94
94
  session = connection.new(uri.host, uri.port)
95
+ session.open_timeout = @timeout
95
96
  session.use_ssl = uri.scheme == 'https'
96
97
  session.start do |conn|
97
98
  conn.read_timeout = @timeout
@@ -1,3 +1,3 @@
1
1
  module Dogapi
2
- VERSION = "1.14.0"
2
+ VERSION = "1.15.0"
3
3
  end
@@ -58,9 +58,6 @@ class TestScreenboard < Test::Unit::TestCase
58
58
  assert_equal status, "200", "invalid HTTP response => #{status}"
59
59
  assert result["widgets"] == board["widgets"]
60
60
 
61
- status, result = dog.get_all_screenboards()
62
- assert_equal status, "200", "invalid HTTP response => #{status}"
63
-
64
61
  status, result = dog.update_screenboard(result["id"], updated_board)
65
62
  assert_equal status, "200", "invalid HTTP response => #{status}"
66
63
  assert result["widgets"] == updated_board["widgets"]
@@ -73,5 +70,8 @@ class TestScreenboard < Test::Unit::TestCase
73
70
  assert_equal status, "200", "invalid HTTP response => #{status}"
74
71
  assert del_result["id"] == result["id"]
75
72
 
73
+ status, result = dog.get_all_screenboards()
74
+ assert_equal status, "200", "invalid HTTP response => #{status}"
75
+
76
76
  end
77
77
  end
metadata CHANGED
@@ -1,71 +1,60 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dogapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.15.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Datadog, Inc.
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-01-09 00:00:00.000000000 Z
12
+ date: 2015-02-03 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: json
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &16861780 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - '>='
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: 1.5.1
20
22
  type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '>='
25
- - !ruby/object:Gem::Version
26
- version: 1.5.1
24
+ version_requirements: *16861780
27
25
  - !ruby/object:Gem::Dependency
28
26
  name: bundler
29
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &16860800 !ruby/object:Gem::Requirement
28
+ none: false
30
29
  requirements:
31
30
  - - ~>
32
31
  - !ruby/object:Gem::Version
33
32
  version: '1.3'
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '1.3'
35
+ version_requirements: *16860800
41
36
  - !ruby/object:Gem::Dependency
42
37
  name: rake
43
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &16859820 !ruby/object:Gem::Requirement
39
+ none: false
44
40
  requirements:
45
41
  - - ~>
46
42
  - !ruby/object:Gem::Version
47
43
  version: '10'
48
44
  type: :development
49
45
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '10'
46
+ version_requirements: *16859820
55
47
  - !ruby/object:Gem::Dependency
56
48
  name: rdoc
57
- requirement: !ruby/object:Gem::Requirement
49
+ requirement: &16858980 !ruby/object:Gem::Requirement
50
+ none: false
58
51
  requirements:
59
- - - '>='
52
+ - - ! '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  type: :development
63
56
  prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
57
+ version_requirements: *16858980
69
58
  description: Ruby bindings for Datadog's API
70
59
  email:
71
60
  - packages@datadoghq.com
@@ -139,7 +128,6 @@ files:
139
128
  homepage: http://datadoghq.com/
140
129
  licenses:
141
130
  - BSD
142
- metadata: {}
143
131
  post_install_message:
144
132
  rdoc_options:
145
133
  - --title
@@ -151,20 +139,22 @@ rdoc_options:
151
139
  require_paths:
152
140
  - lib
153
141
  required_ruby_version: !ruby/object:Gem::Requirement
142
+ none: false
154
143
  requirements:
155
- - - '>='
144
+ - - ! '>='
156
145
  - !ruby/object:Gem::Version
157
146
  version: '0'
158
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
+ none: false
159
149
  requirements:
160
- - - '>='
150
+ - - ! '>='
161
151
  - !ruby/object:Gem::Version
162
152
  version: '0'
163
153
  requirements: []
164
154
  rubyforge_project:
165
- rubygems_version: 2.0.3
155
+ rubygems_version: 1.8.11
166
156
  signing_key:
167
- specification_version: 4
157
+ specification_version: 3
168
158
  summary: Ruby bindings for Datadog's API
169
159
  test_files:
170
160
  - spec/alerts_spec.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 7a2330cb3e89fca5eeabf84fbcdffb53efa658cf
4
- data.tar.gz: 01463c055324568ca094f9153f984083ef40de59
5
- SHA512:
6
- metadata.gz: 7b6f6500aac95e6b21dde0511b88089e2203023f894764eca3ac72acdec8e869224a0e80d818956ffdb2180a3bb8c2b0d8753382fea0a7667fa31d32270f354f
7
- data.tar.gz: b9bd1c6aa13837610cca2092d459a8820a363eb30b721f74619a1be026636bfef77686a49276816a11115ce2adae9fdf921427320a4b7e7089911fd4017b321f