exact_target_rest 0.2.4 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad854f206b815f39d753583d315271e4a4dcc414
|
4
|
+
data.tar.gz: 4983096a2f26a754ba68567f06f11576f7974e41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 &&
|
47
|
+
@access_token && @expires_in > Time.now
|
48
48
|
end
|
49
49
|
|
50
50
|
protected
|
@@ -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
|
+
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-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|