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.
- data/lib/restpack-web/app.rb +9 -5
- data/lib/restpack-web/version.rb +1 -1
- data/spec/restpack_web_spec.rb +1 -1
- metadata +1 -1
data/lib/restpack-web/app.rb
CHANGED
@@ -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
|
20
|
-
|
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
|
data/lib/restpack-web/version.rb
CHANGED
data/spec/restpack_web_spec.rb
CHANGED