cheetahmails 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cheetahmails.rb +12 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: aee984ac6a9285db5c84668cfe43c3984168a747
4
- data.tar.gz: 17caa4d68620ab641c8052048ad26129c1c4a3a2
3
+ metadata.gz: 4482de1f6b194077ffa0c04adc1ae7c6df46d16f
4
+ data.tar.gz: ec7ed6338e8c3d762aaea90ba9e902da674cac14
5
5
  SHA512:
6
- metadata.gz: 650fff6a0faf9565dfd90f2a789ab6bec812b97bac59c073b3e25d2674706bc8ccd5784e9917b43c5cf117e111b2d3ef298ca75d9d415c273a5fb7182c3a466b
7
- data.tar.gz: f52b315512e4567510e989ac18aeb0df8c5742336ad3b2948ed018f4f5467b6e09fecedaeba2cbbc4f3342ae1c091def25dedff2ac0ff04c76b2d511ff25d6e8
6
+ metadata.gz: 1444c376da2dcd5855efbcca8fcf24eb729848a95ad1dc16c3d6277672e6b8425b2762a8552ecf6cd21f046993416a0bd915c1b6353a92b52581c1ee70791099
7
+ data.tar.gz: 19e70f3681f5f3dcd650fe5d4c5990fbf5445d5fd03656e3d50afe7e3eabb5e1b17f6d56c29161ad218bbd76fcfcda12d116d1a1311a72da331616ba96ca5519
@@ -12,11 +12,14 @@ module Cheetahmails
12
12
  def self.get_token(clear_cache = false)
13
13
  tries ||= 2
14
14
 
15
- redis = Redis.new(Cheetahmails.configuration.redis)
16
-
17
- redis.del "cheetahmails_access_token" if clear_cache
15
+ begin
16
+ redis = Redis.new(Cheetahmails.configuration.redis)
17
+ redis.del "cheetahmails_access_token" if clear_cache
18
+ token = redis.get("cheetahmails_access_token")
19
+ rescue => error
20
+ end
18
21
 
19
- if not token = redis.get("cheetahmails_access_token")
22
+ if not token
20
23
 
21
24
  faraday = Faraday.new(:url => @base_uri) do |faraday|
22
25
  faraday.request :url_encoded # form-encode POST params
@@ -41,8 +44,11 @@ module Cheetahmails
41
44
  end
42
45
 
43
46
  if token = jsonresponse["access_token"]
44
- redis.set("cheetahmails_access_token", token)
45
- redis.expire("cheetahmails_access_token", jsonresponse["expires_in"])
47
+ begin
48
+ redis.set("cheetahmails_access_token", token)
49
+ redis.expire("cheetahmails_access_token", jsonresponse["expires_in"])
50
+ rescue => error
51
+ end
46
52
  end
47
53
 
48
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheetahmails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Holder