doggy 2.0.38 → 2.0.39

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 957f7b3de058a28033615d38adc4cde2592e74c6
4
- data.tar.gz: dc8100cfa99575c54904087b55eb01ac97a46d6e
3
+ metadata.gz: 3e04c1e4612bdfa22169dc85914ce496b940a72e
4
+ data.tar.gz: 9588342799f7ef5033f9720456b7e756a913cb6b
5
5
  SHA512:
6
- metadata.gz: 6818fabbc4c59ed124504fed8bade0f29c20d11be312640fc04a7a3448bab6cac5de05e54074c1463d6e15afe3e62bba09f16488cc27fc70f902ad9d9eb21438
7
- data.tar.gz: f95498183a511ec8cc023426ef8273b1d336a3894b445346a1f2de10775e7be1381daa71e3bf3fc5dd21a0e202c4c48fff30dc84a2d4dd0d0068e512e153e4d6
6
+ metadata.gz: 35838ed57e26c6cb0e0f9d20f50503a1247197d48680c5d9db8c467abc13ae13a70f4dd7c0c1f859f91d57e99736a6d370b98baa8d38bdca14f7e88c21ed76b8
7
+ data.tar.gz: 00e55e4ee1f7d3f9c621db78eeec3440f76ae40da3db054b32e70f01a516769269c25624b4ce7e3f2ca5ebb08d1329122b74e945026c8b7d7f73405860ddeabb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- doggy (2.0.37)
4
+ doggy (2.0.39)
5
5
  activesupport (~> 4)
6
6
  json (~> 1.8.3)
7
7
  parallel (~> 1.6.1)
@@ -12,9 +12,8 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (4.2.7.1)
15
+ activesupport (4.2.8)
16
16
  i18n (~> 0.7)
17
- json (~> 1.7, >= 1.7.7)
18
17
  minitest (~> 5.1)
19
18
  thread_safe (~> 0.3, >= 0.3.4)
20
19
  tzinfo (~> 1.1)
@@ -32,9 +31,9 @@ GEM
32
31
  thread_safe (~> 0.3, >= 0.3.1)
33
32
  equalizer (0.0.11)
34
33
  hashdiff (0.2.3)
35
- i18n (0.7.0)
34
+ i18n (0.8.1)
36
35
  ice_nine (0.11.2)
37
- json (1.8.3)
36
+ json (1.8.6)
38
37
  metaclass (0.0.4)
39
38
  minitest (5.9.0)
40
39
  mocha (1.1.0)
@@ -45,7 +44,7 @@ GEM
45
44
  rugged (0.23.3)
46
45
  safe_yaml (1.0.4)
47
46
  thor (0.19.4)
48
- thread_safe (0.3.5)
47
+ thread_safe (0.3.6)
49
48
  tzinfo (1.2.2)
50
49
  thread_safe (~> 0.1)
51
50
  virtus (1.0.5)
@@ -70,4 +69,4 @@ DEPENDENCIES
70
69
  webmock
71
70
 
72
71
  BUNDLED WITH
73
- 1.13.6
72
+ 1.13.7
@@ -3,8 +3,8 @@
3
3
  module Doggy
4
4
  class CLI::Push
5
5
  WARNING_MESSAGE = "You are about to force push all the objects. "\
6
- "This will override changes in Datadog if they have not been sycned to the dog repository. "\
7
- "Do you want to proceed?(Y/N)"
6
+ "This will override changes in Datadog if they have not been synced to the dog repository. "\
7
+ "Do you want to proceed? (Y/N)"
8
8
 
9
9
  def sync_changes
10
10
  changed_resources = Doggy::Model.changed_resources
data/lib/doggy/model.rb CHANGED
@@ -23,7 +23,7 @@ module Doggy
23
23
  attr_accessor :root
24
24
 
25
25
  def find(id)
26
- attributes = request(:get, resource_url(id))
26
+ attributes = request(:get, resource_url(id), nil, [404])
27
27
  return if attributes['errors']
28
28
  resource = new(attributes)
29
29
 
@@ -89,7 +89,7 @@ module Doggy
89
89
  return Models::Screen if has_key.call('board_title')
90
90
  end
91
91
 
92
- def request(method, url, body = nil)
92
+ def request(method, url, body = nil, accepted_errors = nil)
93
93
  uri = URI(url)
94
94
 
95
95
  if uri.query
@@ -112,10 +112,20 @@ module Doggy
112
112
  request.body = body if body
113
113
 
114
114
  response = http.request(request)
115
- unless response.code =~ /\A[23][0-9]{2}\Z/
116
- raise DoggyError, "Unexpected response code #{response.code} for #{url}."
115
+ parsed_response = response.body ? JSON.parse(response.body) : nil
116
+
117
+ unless accepted_response(response.code.to_i, accepted_errors)
118
+ raise DoggyError, "Unexpected response code #{response.code} for #{url}, body: #{parsed_response.to_s}"
119
+ end
120
+ parsed_response
121
+ end
122
+
123
+ def accepted_response(code, accepted_errors = nil)
124
+ if (accepted_errors != nil) && (accepted_errors.include? code)
125
+ true
126
+ else
127
+ code >= 200 && code < 400
117
128
  end
118
- response.body ? JSON.parse(response.body) : nil
119
129
  end
120
130
 
121
131
  def current_sha
data/lib/doggy/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module Doggy
4
- VERSION = '2.0.38'
4
+ VERSION = '2.0.39'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: doggy
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.38
4
+ version: 2.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vlad Gorodetsky
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-02-09 00:00:00.000000000 Z
12
+ date: 2017-03-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json