desk 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/desk/error.rb +10 -1
- data/lib/desk/version.rb +1 -1
- data/lib/faraday/response/raise_http_4xx.rb +4 -0
- data/lib/faraday/response/raise_http_5xx.rb +2 -0
- data/spec/faraday/response_spec.rb +3 -0
- metadata +39 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f926d97b5fc39286bf389cebdb88428ea8531306
|
4
|
+
data.tar.gz: 76e166841adebf6306cbaea906cb110670973ff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4fdd54b6835dc4e01cf4af7e0dd1953a5db6e5c82eab7c9db0b3d1e9e22a0f73ca99b959e4ece3f0b5cf96546a2b808e981fbd9643496619d2a6038742667215
|
7
|
+
data.tar.gz: f270f1064a257231bdafe3d4f7b4fb0bc68d537dc48357e8bf3ca3644c738804bd14ea9f91294ad62177aa58d8a2055030cd770906b74484f7be8d07a803b5a5
|
data/lib/desk/error.rb
CHANGED
@@ -41,16 +41,25 @@ module Desk
|
|
41
41
|
# Raised when Desk returns the HTTP status code 406
|
42
42
|
class NotAcceptable < Error; end
|
43
43
|
|
44
|
+
# Raised when Desk returns the HTTP status code 409
|
45
|
+
class Conflict < Error; end
|
46
|
+
|
47
|
+
# Raised when Desk returns the HTTP status code 422
|
48
|
+
class Unprocessable < Error; end
|
49
|
+
|
44
50
|
# Raised when Desk returns the HTTP status code 429
|
45
51
|
# Called EnhanceYourCalm because TooManyRequests is taken (see below)
|
46
52
|
class EnhanceYourCalm < Error; end
|
47
|
-
|
53
|
+
|
48
54
|
# Raised when Desk max_requests is reached and use_max_requests is set to true
|
49
55
|
class TooManyRequests < StandardError; end
|
50
56
|
|
51
57
|
# Raised when Desk returns the HTTP status code 500
|
52
58
|
class InternalServerError < Error; end
|
53
59
|
|
60
|
+
# Raised when Desk returns the HTTP status code 501
|
61
|
+
class NotImplemented < Error; end
|
62
|
+
|
54
63
|
# Raised when Desk returns the HTTP status code 502
|
55
64
|
class BadGateway < Error; end
|
56
65
|
|
data/lib/desk/version.rb
CHANGED
@@ -16,6 +16,10 @@ module Faraday
|
|
16
16
|
raise Desk::NotFound.new(error_message(env), env[:response_headers])
|
17
17
|
when 406
|
18
18
|
raise Desk::NotAcceptable.new(error_message(env), env[:response_headers])
|
19
|
+
when 409
|
20
|
+
raise Desk::Conflict.new(error_message(env), env[:response_headers])
|
21
|
+
when 422
|
22
|
+
raise Desk::Unprocessable.new(error_message(env), env[:response_headers])
|
19
23
|
when 429
|
20
24
|
raise Desk::EnhanceYourCalm.new(error_message(env), env[:response_headers])
|
21
25
|
end
|
@@ -8,6 +8,8 @@ module Faraday
|
|
8
8
|
case env[:status].to_i
|
9
9
|
when 500
|
10
10
|
raise Desk::InternalServerError.new(error_message(env, "Something is technically wrong."), env[:response_headers])
|
11
|
+
when 501
|
12
|
+
raise Desk::NotImplemented.new(error_message(env, "Not implemented."), env[:response_headers])
|
11
13
|
when 502
|
12
14
|
raise Desk::BadGateway.new(error_message(env, "Desk.com is down or being upgraded."), env[:response_headers])
|
13
15
|
when 503
|
@@ -11,8 +11,11 @@ describe Faraday::Response do
|
|
11
11
|
403 => Desk::Forbidden,
|
12
12
|
404 => Desk::NotFound,
|
13
13
|
406 => Desk::NotAcceptable,
|
14
|
+
409 => Desk::Conflict,
|
15
|
+
422 => Desk::Unprocessable,
|
14
16
|
429 => Desk::EnhanceYourCalm,
|
15
17
|
500 => Desk::InternalServerError,
|
18
|
+
501 => Desk::NotImplemented,
|
16
19
|
502 => Desk::BadGateway,
|
17
20
|
503 => Desk::ServiceUnavailable,
|
18
21
|
}.each do |status, exception|
|
metadata
CHANGED
@@ -1,223 +1,223 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: desk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Warren
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.4'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: maruku
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0.6'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.6'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.5'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '2.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: email_spec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 1.1.1
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 1.1.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: simplecov
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.4'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.4'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: webmock
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.6'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '1.6'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: yard
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0.6'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0.6'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: hashie
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- -
|
129
|
+
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '2.1'
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- -
|
136
|
+
- - ~>
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '2.1'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: faraday
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ~>
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: 0.9.0
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ~>
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 0.9.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: faraday_middleware
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ~>
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: 0.9.0
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ~>
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.9.0
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: multi_json
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ~>
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '1.6'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ~>
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '1.6'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: multi_xml
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
|
-
- -
|
185
|
+
- - ~>
|
186
186
|
- !ruby/object:Gem::Version
|
187
187
|
version: '0.5'
|
188
188
|
type: :runtime
|
189
189
|
prerelease: false
|
190
190
|
version_requirements: !ruby/object:Gem::Requirement
|
191
191
|
requirements:
|
192
|
-
- -
|
192
|
+
- - ~>
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0.5'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
196
|
name: simple_oauth
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ~>
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: 0.2.0
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - ~>
|
207
207
|
- !ruby/object:Gem::Version
|
208
208
|
version: 0.2.0
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: pony
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
|
-
- -
|
213
|
+
- - ~>
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '1.1'
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
|
-
- -
|
220
|
+
- - ~>
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '1.1'
|
223
223
|
description: A Ruby wrapper for the Desk.com REST API
|
@@ -227,10 +227,10 @@ executables: []
|
|
227
227
|
extensions: []
|
228
228
|
extra_rdoc_files: []
|
229
229
|
files:
|
230
|
-
-
|
231
|
-
-
|
232
|
-
-
|
233
|
-
-
|
230
|
+
- .gemtest
|
231
|
+
- .gitignore
|
232
|
+
- .rspec
|
233
|
+
- .yardopts
|
234
234
|
- Gemfile
|
235
235
|
- HISTORY.mkd
|
236
236
|
- LICENSE.mkd
|
@@ -407,17 +407,17 @@ require_paths:
|
|
407
407
|
- lib
|
408
408
|
required_ruby_version: !ruby/object:Gem::Requirement
|
409
409
|
requirements:
|
410
|
-
- -
|
410
|
+
- - '>='
|
411
411
|
- !ruby/object:Gem::Version
|
412
412
|
version: '0'
|
413
413
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
414
414
|
requirements:
|
415
|
-
- -
|
415
|
+
- - '>='
|
416
416
|
- !ruby/object:Gem::Version
|
417
417
|
version: 1.3.6
|
418
418
|
requirements: []
|
419
419
|
rubyforge_project: desk
|
420
|
-
rubygems_version: 2.
|
420
|
+
rubygems_version: 2.0.3
|
421
421
|
signing_key:
|
422
422
|
specification_version: 4
|
423
423
|
summary: Ruby wrapper for the Desk.com API
|
@@ -545,4 +545,3 @@ test_files:
|
|
545
545
|
- spec/helper.rb
|
546
546
|
- spec/shared_context.rb
|
547
547
|
- spec/shared_examples.rb
|
548
|
-
has_rdoc:
|