conversocial 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b34db0e83791d1bbf1a30d29ef5b38bba3a95373
|
4
|
+
data.tar.gz: 1102cf3e97669434be74f0bb98aeb21d82a142d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36d37e8a4b42a18575ff8343f92b8351485f5d9258a7c2f9f75ce2231567f7119e389375cd7ba6cdbbab62a3bc6d8982e0d8f1fc1998b340cda525347ce2e66a
|
7
|
+
data.tar.gz: b54452fe8a57f4901c33a2bb347199f7203a77d61369b3d5d5d1b1318dd30d5534e2456bcc73cd6dc8b65e3561f9815c5e2da6982d8e453d6b47ea0f38c0edeb
|
@@ -195,10 +195,12 @@ module Conversocial
|
|
195
195
|
def get_json path
|
196
196
|
full_path = absolute_path path
|
197
197
|
|
198
|
-
response = @cache.get_or_set full_path
|
198
|
+
response = @cache.get_or_set full_path, :get => ->(){
|
199
199
|
client.send :log, self, full_path
|
200
200
|
https_basic_auth_get client.key, client.secret, full_path
|
201
|
-
|
201
|
+
}, :if => ->( response ){
|
202
|
+
response.code.to_i >= 200 && response.code.to_i < 300
|
203
|
+
}
|
202
204
|
|
203
205
|
if 429 == response.code.to_i
|
204
206
|
raise Conversocial::Resources::Exceptions::RateLimitExceeded.new response.code, nil, response.body
|
@@ -9,11 +9,13 @@ module Conversocial
|
|
9
9
|
@expiry = expiry.to_i
|
10
10
|
end
|
11
11
|
|
12
|
-
def get_or_set key
|
12
|
+
def get_or_set key, options
|
13
13
|
result = get key
|
14
14
|
if result.nil?
|
15
|
-
result =
|
16
|
-
|
15
|
+
result = options[:get].call
|
16
|
+
if options[:if].call result
|
17
|
+
set key, result
|
18
|
+
end
|
17
19
|
end
|
18
20
|
result
|
19
21
|
end
|
data/lib/conversocial/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conversocial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Misha Conway
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|