alephant-broker 1.0.1 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce3d6afda8699e8e18f0988692abcd9abdc23bd5
4
- data.tar.gz: 83fd6ac78a25d9d412ada73b072c48216a0a6793
3
+ metadata.gz: d7c2a4bd832e9620f656243342fb612dd1abef6d
4
+ data.tar.gz: 473481c1bb7c731e2c5e7e85aa5a27e8d730d279
5
5
  SHA512:
6
- metadata.gz: 8314f42ed32e235903b076ddbb0649945114e406ffb548a990aab0e47ef7ee00907c79043d5d01fd5c7fc5543371d471ed09f169f8d096fbf454e268c9708c21
7
- data.tar.gz: 2d9a27867bf43318d8bc1c5490bf0e4f8c7952ec3687c8939bf148788d00888c2a5806fdf663dc5c29b9c629ee836a71c8b60031ebee60f3784bbf7b98f55e00
6
+ metadata.gz: 4a89f89e007355da7bc32af8cfae1b105a38ae0d9dfa866b56eaf0bab89647a4ecdab9a891fe884c64985103b0e65aa05a04f63eb472f9cf690ff32a132f9301
7
+ data.tar.gz: bdbe66a5a920843cfecb4ba5292aa65b88f93df3f332b9e4c6fca9030b77c5e99a2f05e4b2a2f3b6d6d89015353c74a5021369482b12aa8703de074c312e62d9
@@ -38,7 +38,11 @@ module Alephant
38
38
  def send(response)
39
39
  [
40
40
  response.status,
41
- { "Content-Type" => response.content_type },
41
+ {
42
+ "Content-Type" => response.content_type,
43
+ "X-Version" => response.version.to_s,
44
+ "X-Cached" => response.cached.to_s
45
+ },
42
46
  [ response.content.to_s ]
43
47
  ]
44
48
  end
@@ -12,17 +12,19 @@ module Alephant
12
12
  class Component
13
13
  include Logger
14
14
 
15
- attr_reader :id, :batch_id, :options, :content
15
+ attr_reader :id, :batch_id, :options, :content, :cached
16
16
 
17
17
  def initialize(id, batch_id, options)
18
18
  @id = id
19
19
  @batch_id = batch_id
20
20
  @cache = Cache::Client.new
21
21
  @options = symbolize(options || {})
22
+ @cached = true
22
23
  end
23
24
 
24
25
  def load
25
26
  @content ||= @cache.get(cache_key) do
27
+ @cached = false
26
28
  s3.get(s3_path)
27
29
  end
28
30
  end
@@ -15,10 +15,12 @@ module Alephant
15
15
  end
16
16
 
17
17
  def setup
18
- result = load(component)
19
18
 
19
+ result = load(component)
20
20
  @status = result['status']
21
21
  @content = result['body']
22
+ @version = component.version.nil? ? 'not available' : component.version
23
+ @cached = component.cached
22
24
  end
23
25
 
24
26
  end
@@ -4,7 +4,7 @@ module Alephant
4
4
  module Broker
5
5
  module Response
6
6
  class Base
7
- attr_accessor :status, :content, :content_type
7
+ attr_accessor :status, :content, :content_type, :version, :cached
8
8
 
9
9
  STATUS_CODE_MAPPING = {
10
10
  200 => 'ok',
@@ -1,5 +1,5 @@
1
1
  module Alephant
2
2
  module Broker
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  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: 1.0.1
4
+ version: 1.0.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-04-17 00:00:00.000000000 Z
11
+ date: 2014-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec