fragment_client 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/fragment_client.rb +5 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdc59ddf16fbdaceca9a66c33b7720698fe20e20
|
4
|
+
data.tar.gz: bcd39fa7e8dc09fd03f66c1bba682ca6a3364c92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b5b240fe1aa2d962bfcc686624a86df2ef38ad39475f86a598504e77d4e0785d48b9e509babb9ee4c75a6db5777d38360dcb3a2c612d2edb7384f1336f7ac41
|
7
|
+
data.tar.gz: f9f559cc1c0567ee902a4af051917ec77ce7374d334fc4abcd92cc9c6ed23d637adb913c06b19415bfd103a507ba03dcb8a75fc19b00014b3f6b3f522638f3e8
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ A Ruby gem that provides an interface to the fragment_server for easy use in web
|
|
5
5
|
The fragment client provides an easy method to fetch snippets of markup from the fragment server. E.G.
|
6
6
|
|
7
7
|
```ruby
|
8
|
-
client = FragmentClient.new
|
8
|
+
client = FragmentClient.new('app_name')
|
9
9
|
client.fetch('footer')
|
10
10
|
client.fetch('navigation', options)
|
11
11
|
```
|
@@ -24,4 +24,4 @@ client.fetch('navigation', options)
|
|
24
24
|
|
25
25
|
##Caching
|
26
26
|
|
27
|
-
|
27
|
+
The fragment client attempts to cache responses wherever possible.
|
data/lib/fragment_client.rb
CHANGED
@@ -3,10 +3,12 @@ require 'memory_cache'
|
|
3
3
|
require 'net/http'
|
4
4
|
|
5
5
|
class FragmentClient
|
6
|
-
attr_accessor :fragment_server_url, :option_params, :cache, :logger
|
6
|
+
attr_accessor :app_name, :fragment_server_url, :option_params, :cache, :logger
|
7
|
+
|
7
8
|
DEFAULT_URL = 'http://test-eva-fragment-server.herokuapp.com/fragments/full.json?'
|
8
9
|
|
9
|
-
def initialize(fragment_server_url=DEFAULT_URL, cache=MemoryCache.new, logger=default_logger)
|
10
|
+
def initialize(app_name, fragment_server_url=DEFAULT_URL, cache=MemoryCache.new, logger=default_logger)
|
11
|
+
self.app_name = app_name
|
10
12
|
self.fragment_server_url = fragment_server_url
|
11
13
|
self.cache = cache
|
12
14
|
self.logger = logger
|
@@ -37,7 +39,7 @@ class FragmentClient
|
|
37
39
|
end
|
38
40
|
|
39
41
|
def default_options
|
40
|
-
{ has_login: true, logged_in: false, logo: 'red'}
|
42
|
+
{ has_login: true, logged_in: false, logo: 'red', app:app_name}
|
41
43
|
end
|
42
44
|
|
43
45
|
def request
|