embark-journey 0.0.18 → 0.0.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/active_resource/active_resource.rb +1 -0
- data/lib/active_resource/connection.rb +46 -0
- data/lib/journey/resource/api.rb +1 -3
- data/lib/journey/version.rb +1 -1
- data/spec/models/journey/resource_spec.rb +6 -0
- data/spec/support/logger.rb +3 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38fb94a63607831e3d56e03bbb6edfd5f0e89b60
|
4
|
+
data.tar.gz: 159256956082415247d7665146873a892b5cd708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd02d82934a789add381c50e8811294afa29702a245f848a6737f952120658bfd0ee686f62bf4ad13d87be17a4d7e656d2c9c7e983bbd9187ad7bca801cc9d9b
|
7
|
+
data.tar.gz: 05f573d69c2747f135d250634928014dfae62d00178c323bf003b4dc4efcf3ca4d99a579211b628a1fb588eff1dc0065e8276f2b478f837ec20e2882f04bbcc9
|
data/CHANGELOG.md
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'active_resource/connection'
|
2
|
+
|
3
|
+
module ActiveResource
|
4
|
+
class Connection
|
5
|
+
|
6
|
+
def handle_response(response)
|
7
|
+
if response.respond_to?(:header) && (response.header["content-encoding"] == 'gzip')
|
8
|
+
begin
|
9
|
+
response.instance_variable_set('@body', ActiveSupport::Gzip.decompress(response.body))
|
10
|
+
rescue Exception => e
|
11
|
+
raise(BadRequest.new(response))
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
case response.code.to_i
|
16
|
+
when 301, 302, 303, 307
|
17
|
+
raise(Redirection.new(response))
|
18
|
+
when 200...400
|
19
|
+
response
|
20
|
+
when 400
|
21
|
+
raise(BadRequest.new(response))
|
22
|
+
when 401
|
23
|
+
raise(UnauthorizedAccess.new(response))
|
24
|
+
when 403
|
25
|
+
raise(ForbiddenAccess.new(response))
|
26
|
+
when 404
|
27
|
+
raise(ResourceNotFound.new(response))
|
28
|
+
when 405
|
29
|
+
raise(MethodNotAllowed.new(response))
|
30
|
+
when 409
|
31
|
+
raise(ResourceConflict.new(response))
|
32
|
+
when 410
|
33
|
+
raise(ResourceGone.new(response))
|
34
|
+
when 422
|
35
|
+
raise(ResourceInvalid.new(response))
|
36
|
+
when 401...500
|
37
|
+
raise(ClientError.new(response))
|
38
|
+
when 500...600
|
39
|
+
raise(ServerError.new(response))
|
40
|
+
else
|
41
|
+
raise(ConnectionError.new(response, "Unknown response code: #{response.code}"))
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/journey/resource/api.rb
CHANGED
@@ -6,8 +6,6 @@ module Journey::Resource::API
|
|
6
6
|
included do
|
7
7
|
self.format = :json
|
8
8
|
self.include_root_in_json = true
|
9
|
-
|
10
|
-
# self.user = ENV['JOURNEY_API_USERNAME']
|
11
|
-
# self.password = ENV['JOURNEY_API_KEY']
|
9
|
+
self.headers['accept-encoding'] = 'gzip'
|
12
10
|
end
|
13
11
|
end
|
data/lib/journey/version.rb
CHANGED
@@ -7,6 +7,12 @@ describe Journey::Resource do
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
context 'gzip performance patch' do
|
11
|
+
it 'automatically enables gzip' do
|
12
|
+
expect(klass.headers['accept-encoding']).to eq 'gzip'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
10
16
|
describe '::Enums' do
|
11
17
|
describe '.enum' do
|
12
18
|
let(:statuses) { %w(Active Inactive) }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embark-journey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Davey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_attr
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/active_resource/active_resource.rb
|
144
144
|
- lib/active_resource/associations.rb
|
145
145
|
- lib/active_resource/associations/builder/belongs_to.rb
|
146
|
+
- lib/active_resource/connection.rb
|
146
147
|
- lib/journey.rb
|
147
148
|
- lib/journey/configurable.rb
|
148
149
|
- lib/journey/configuration.rb
|
@@ -165,6 +166,7 @@ files:
|
|
165
166
|
- spec/models/journey/resource_spec.rb
|
166
167
|
- spec/spec_helper.rb
|
167
168
|
- spec/support/configuration_cache.rb
|
169
|
+
- spec/support/logger.rb
|
168
170
|
- spec/support/test_configuration.rb
|
169
171
|
homepage: ''
|
170
172
|
licenses:
|
@@ -198,4 +200,5 @@ test_files:
|
|
198
200
|
- spec/models/journey/resource_spec.rb
|
199
201
|
- spec/spec_helper.rb
|
200
202
|
- spec/support/configuration_cache.rb
|
203
|
+
- spec/support/logger.rb
|
201
204
|
- spec/support/test_configuration.rb
|