exact_target_rest 0.2.5 → 0.2.6
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: 4fd81d7b51fc3a0a389a5e3e98e9d9d4bbaff41b
|
4
|
+
data.tar.gz: 287c1359af2164f62143922b6aa3c3691438041c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad5925146340d6ef5aeb26ffa2dffdf9410e7eeba2cf4f6eb450bc4cca88d16f4cbef6f5d7f0b96acf92a52545effd39d3edc8d0b22370a698940f955fc3a369
|
7
|
+
data.tar.gz: 6f0895367b4ea39a60c6d75b02e8e11152b9b71691b338d45ac73a46ca54d4b438058ad8974fd85f711430a00b0de0f9435bba7a843aef1e187b8ed16dc03daa
|
data/README.md
CHANGED
@@ -6,6 +6,7 @@ module ExactTargetRest
|
|
6
6
|
class Authorization
|
7
7
|
attr_reader :access_token
|
8
8
|
attr_reader :expires_in
|
9
|
+
attr_reader :expires_at
|
9
10
|
|
10
11
|
# New authorization (it does not trigger REST yet).
|
11
12
|
#
|
@@ -35,7 +36,8 @@ module ExactTargetRest
|
|
35
36
|
end
|
36
37
|
if resp.success?
|
37
38
|
@access_token = resp.body['accessToken']
|
38
|
-
@expires_in =
|
39
|
+
@expires_in = resp.body['expiresIn']
|
40
|
+
@expires_at = Time.now + @expires_in
|
39
41
|
self
|
40
42
|
else
|
41
43
|
fail NotAuthorizedError
|
@@ -44,7 +46,7 @@ module ExactTargetRest
|
|
44
46
|
|
45
47
|
# Already authorized and NOT expired?
|
46
48
|
def authorized?
|
47
|
-
@access_token && @
|
49
|
+
@access_token && @expires_at > Time.now
|
48
50
|
end
|
49
51
|
|
50
52
|
protected
|
@@ -55,7 +55,7 @@ describe Authorization do
|
|
55
55
|
it "returns FALSE when authorization Expired" do
|
56
56
|
auth = subject.new(client_id, client_secret).authorize!
|
57
57
|
|
58
|
-
allow(Time).to receive(:now).and_return(auth.
|
58
|
+
allow(Time).to receive(:now).and_return(auth.expires_at + 1)
|
59
59
|
expect(auth.authorized?).to be false
|
60
60
|
end
|
61
61
|
end
|
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.6
|
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-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|