exact_target_rest 0.2.4 → 0.2.5

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: e1aae8d038af8c94d376bd83c559e0ea98a0a611
4
- data.tar.gz: e160cf3bca7bde14c48272865a3daaacc3b05ee8
3
+ metadata.gz: ad854f206b815f39d753583d315271e4a4dcc414
4
+ data.tar.gz: 4983096a2f26a754ba68567f06f11576f7974e41
5
5
  SHA512:
6
- metadata.gz: 9943d608b41c9f1a21abb3fce489a37cd9651a4671d2a532d2dd8f0dfdaca27f51653b6579f6694ca8b6ff811e6391a42728908030c0a509b968444fe93840f8
7
- data.tar.gz: 89e6c8baae62e3daed7a914d6465de164d91d9f43d8d9dc81da7821cb1dfa3e232fa5274ca7330e66deb591a68ccc3338db5c6205530f2b1cb0ffe323d726de1
6
+ metadata.gz: e4647a5fd4781a1bdaf4897eed75787c733a056a80edfd84f961ae8e4c21e82da35e1e4069aa17f4168531c0a6e3c1e08dd336daef8c7e7d335b11a574d5691e
7
+ data.tar.gz: 0b3a80093dcd0f4034b1e7310596e4e918c3d1ffffbcac5538f63f295b238c49e5d2fb774ef3d79a156db77aec2ac4c21b2e7aa023a797ada87ff9a1d8f7676e
@@ -35,7 +35,7 @@ module ExactTargetRest
35
35
  end
36
36
  if resp.success?
37
37
  @access_token = resp.body['accessToken']
38
- @expires_in = resp.body['expiresIn']
38
+ @expires_in = Time.now + resp.body['expiresIn']
39
39
  self
40
40
  else
41
41
  fail NotAuthorizedError
@@ -44,7 +44,7 @@ module ExactTargetRest
44
44
 
45
45
  # Already authorized and NOT expired?
46
46
  def authorized?
47
- @access_token && (Time.now + @expires_in) > Time.now
47
+ @access_token && @expires_in > Time.now
48
48
  end
49
49
 
50
50
  protected
@@ -1,3 +1,3 @@
1
1
  module ExactTargetRest
2
- VERSION = '0.2.4'
2
+ VERSION = '0.2.5'
3
3
  end
@@ -45,6 +45,21 @@ describe Authorization do
45
45
  end
46
46
  end
47
47
 
48
+ describe '#authorized?' do
49
+ it "returns TRUE when authorization NOT Expired" do
50
+ auth = subject.new(client_id, client_secret).authorize!
51
+
52
+ expect(auth.authorized?).to be true
53
+ end
54
+
55
+ it "returns FALSE when authorization Expired" do
56
+ auth = subject.new(client_id, client_secret).authorize!
57
+
58
+ allow(Time).to receive(:now).and_return(auth.expires_in + 1)
59
+ expect(auth.authorized?).to be false
60
+ end
61
+ end
62
+
48
63
  describe '#to_yaml' do
49
64
  it "serializes and deserializes Authorization" do
50
65
  auth = subject.new(client_id, client_secret).authorize!
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exact_target_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronie Uliana
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-22 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday