restpack-core-client 0.1.18 → 0.1.19
Sign up to get free protection for your applications and to get access to all the features.
@@ -2,27 +2,28 @@ module RestPack
|
|
2
2
|
module Core
|
3
3
|
module Client
|
4
4
|
class Cache
|
5
|
+
attr_accessor :configurations
|
6
|
+
|
5
7
|
def initialize(api)
|
6
8
|
@api = api
|
7
9
|
@channel_ids = {}
|
8
10
|
@channels = {}
|
9
11
|
@configurations = api.root_configurations
|
10
12
|
end
|
11
|
-
|
13
|
+
|
12
14
|
def self.create(domain, access_key)
|
13
15
|
api = RestPack::Core::Client::API.new(domain, access_key)
|
14
16
|
Cache.new(api)
|
15
17
|
end
|
16
|
-
|
18
|
+
|
17
19
|
def get_channel(host)
|
18
20
|
channel_id = get_channel_id(host)
|
19
21
|
@channels[channel_id] ||= @api.get_channel(channel_id)
|
20
22
|
end
|
21
|
-
|
23
|
+
|
22
24
|
def get_channel_id(host)
|
23
25
|
@channel_ids[host] ||= @api.get_domain(host)[:channel_id]
|
24
26
|
end
|
25
|
-
|
26
27
|
end
|
27
28
|
end
|
28
29
|
end
|