alephant-broker 0.1.1 → 0.1.2
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/lib/alephant/broker/models/request/get_request.rb +1 -1
- data/lib/alephant/broker/models/request_factory.rb +1 -1
- data/lib/alephant/broker/models/request_handler.rb +3 -10
- data/lib/alephant/broker/models/response/asset_response.rb +4 -10
- data/lib/alephant/broker/models/response_factory.rb +4 -5
- data/lib/alephant/broker/version.rb +1 -1
- data/spec/rack_spec.rb +4 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a1b76434c055f4c00da0b9c3f3d5e890cf214b17
|
4
|
+
data.tar.gz: 37cf91c81f2defc12f72bb7a294558aa7d132aa7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b04c27451fbe768abe05155821acbccb51b0ce85b2dc62aa994466d7e3422ac992542fef5a2cea6c9f0999e8331a500bc7650a81e159a577aa36cbbebb1574b
|
7
|
+
data.tar.gz: 586130904e241c497b9ce8e4dc01e4cd8a8830c64fdfdecef64ed5e99326d0e7f522bf68d408dc68a6e9daf55a5ee5427e1fb080f1d00a67317046e8412da64a
|
@@ -7,9 +7,9 @@ module Alephant
|
|
7
7
|
attr_reader :type, :component_id, :extension, :options, :content_type
|
8
8
|
|
9
9
|
def initialize
|
10
|
+
super(:asset)
|
10
11
|
env = RequestStore.store[:env]
|
11
12
|
parse requested_components(env.path, env.query)
|
12
|
-
super(:asset)
|
13
13
|
end
|
14
14
|
|
15
15
|
def requested_components(path, query_string)
|
@@ -32,7 +32,9 @@ module Alephant
|
|
32
32
|
def request_type
|
33
33
|
case env.request_type
|
34
34
|
when 'components'
|
35
|
-
|
35
|
+
:components_batch
|
36
|
+
when 'component'
|
37
|
+
:component
|
36
38
|
when 'status'
|
37
39
|
:status
|
38
40
|
else
|
@@ -40,15 +42,6 @@ module Alephant
|
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
43
|
-
def component_type
|
44
|
-
case env.method
|
45
|
-
when 'POST'
|
46
|
-
:component_batch
|
47
|
-
when 'GET'
|
48
|
-
:component
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
45
|
def env
|
53
46
|
@env ||= RequestStore.store[:env]
|
54
47
|
end
|
@@ -41,19 +41,17 @@ module Alephant
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def s3_path
|
44
|
-
lookup.read(
|
44
|
+
lookup.read(component_id, request.options, version).tap do |lookup_object|
|
45
|
+
raise InvalidCacheKey if lookup_object.location.nil?
|
46
|
+
end.location unless version.nil?
|
45
47
|
end
|
46
48
|
|
47
49
|
def lookup
|
48
50
|
@lookup ||= Alephant::Lookup.create(config[:lookup_table_name])
|
49
51
|
end
|
50
52
|
|
51
|
-
def asset?
|
52
|
-
request.type == :asset
|
53
|
-
end
|
54
|
-
|
55
53
|
def key
|
56
|
-
|
54
|
+
request.type == :batch ? renderer_key : component_key
|
57
55
|
end
|
58
56
|
|
59
57
|
def component_key
|
@@ -64,10 +62,6 @@ module Alephant
|
|
64
62
|
"#{renderer_id}/#{opts_hash}"
|
65
63
|
end
|
66
64
|
|
67
|
-
def id
|
68
|
-
asset? ? component_id : renderer_id
|
69
|
-
end
|
70
|
-
|
71
65
|
def component_id
|
72
66
|
request.component_id
|
73
67
|
end
|
data/spec/rack_spec.rb
CHANGED
@@ -48,14 +48,14 @@ describe 'Broker Rack Application' do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "Test asset data is returned" do
|
51
|
-
get '/
|
51
|
+
get '/component/test_component'
|
52
52
|
|
53
53
|
expect(last_response).to be_ok
|
54
54
|
expect(last_response.body).to eq('Test')
|
55
55
|
end
|
56
56
|
|
57
57
|
it "Tests query string parameters are passed correctly to lookup" do
|
58
|
-
get '/
|
58
|
+
get '/component/test_component?variant=test_variant'
|
59
59
|
|
60
60
|
expect(last_response).to be_ok
|
61
61
|
expect(last_response.body).to eq('Test')
|
@@ -67,7 +67,7 @@ describe 'Broker Rack Application' do
|
|
67
67
|
.stub(:status)
|
68
68
|
.and_return(404)
|
69
69
|
|
70
|
-
get '/
|
70
|
+
get '/component/test_component'
|
71
71
|
|
72
72
|
expect(last_response.status).to eq(404)
|
73
73
|
end
|
@@ -78,7 +78,7 @@ describe 'Broker Rack Application' do
|
|
78
78
|
.stub(:status)
|
79
79
|
.and_return(500)
|
80
80
|
|
81
|
-
get '/
|
81
|
+
get '/component/test_component'
|
82
82
|
|
83
83
|
expect(last_response.status).to eq(500)
|
84
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alephant-broker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|