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: 6c42f9330f82bab1e667f6bea9c1ba0b5e362ef1
4
- data.tar.gz: bba02656ef441ecf363e587f4d49e97ceed80bc9
3
+ metadata.gz: b34db0e83791d1bbf1a30d29ef5b38bba3a95373
4
+ data.tar.gz: 1102cf3e97669434be74f0bb98aeb21d82a142d0
5
5
  SHA512:
6
- metadata.gz: c114cd299740b29b8743bf5fb208a3d17fd776a82f3241ab3957154001c667a0ff06d3f3a7a90da3073aad14dd34e4edd1d4320f8c01c8b49fe3c075dca0c58a
7
- data.tar.gz: 52cad5373410c2757c0047013f903d208ee56ab001ab8b42f556dd483f43b1cd7d6dfd5ac170610d2932ad4a0b67b2c7d6e5a81c4a3878202aaf3f9a9c657946
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 do
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
- end
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 = yield
16
- set key, result
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
@@ -1,3 +1,3 @@
1
1
  module Conversocial
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
3
3
  end
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.9
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-01 00:00:00.000000000 Z
11
+ date: 2014-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler