restpack-web 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ require 'restpack-core-client'
2
+
1
3
  module RestPack
2
4
  module Web
3
5
  class App
@@ -7,17 +9,19 @@ module RestPack
7
9
  @settings = settings
8
10
 
9
11
  @core_cache = RestPack::Core::Client::Cache.create(@settings[:core_domain], @settings[:password])
10
- account = cache.get_channel('account.rubyjobs.ie')
11
-
12
- p "account: #{account}"
13
12
  end
14
13
 
15
14
  def call(env)
16
15
  env["restpack"] ||= {}
17
16
  host = env["SERVER_NAME"]
18
17
 
19
- env["restpack"][:host] = host #TODO: GJ: add some magic
20
- env["restpack"][:settings] = @settings.to_json
18
+ env["restpack"][:host] = host
19
+ begin #TODO: GJ: cache should handle errors gracefully
20
+ env["restpack"][:channel] = @core_cache.get_channel(host)
21
+ rescue Exception => e
22
+ p e.message
23
+ p e.backtrace.inspect
24
+ end
21
25
 
22
26
  @app.call(env)
23
27
  end
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Web
3
- VERSION = "0.0.9"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -13,7 +13,7 @@ describe RestPack::Web do
13
13
  let(:app) {
14
14
  RestPack::Web::App.new(
15
15
  lambda { |env| [200, {'Content-Type' => 'text/plain'}, 'hello there'] },
16
- { :aa => 444 }
16
+ { core_domain: 'localhost:1111', password: '1234' }
17
17
  )
18
18
  }
19
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack-web
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: