smileback 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/smileback/version.rb +1 -1
- data/lib/smileback.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d82ea5157757d5f5627be6d0a05f1d0fae2af553bc3f78b0c13930f2761be2d
|
4
|
+
data.tar.gz: acecbc4969ca0e162b5265fbd66a8e051d80355dfb376a7f8fcf64d3bdb84da3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4e434fb2718b59fff288b7d868c3018728b06fb4ebf9cc64a3716f6a7e0602352c690fabb43ab2ed401365d19354465f12c06946c1b8efe8bc382e5570e958e
|
7
|
+
data.tar.gz: d00e3669245d57351c20dcdbdf000d8a3bb371eb009f600536754d95dd010fa3d44e4d94a67bbdc237309147594b589d3f76d2ba74097fb46832064e8b044973
|
data/lib/smileback/version.rb
CHANGED
data/lib/smileback.rb
CHANGED
@@ -10,6 +10,8 @@ module Smileback
|
|
10
10
|
|
11
11
|
debug_output $stdout
|
12
12
|
|
13
|
+
attr_accessor :access_token
|
14
|
+
|
13
15
|
def initialize(token:, refresh_token:, expires_at:, expires: true)
|
14
16
|
self.class.base_uri Smileback.configuration.api_base_url
|
15
17
|
|
@@ -25,9 +27,9 @@ module Smileback
|
|
25
27
|
# @return [Hash]
|
26
28
|
def credentials
|
27
29
|
{
|
28
|
-
token:
|
29
|
-
refresh_token:
|
30
|
-
expires_at:
|
30
|
+
token: access_token.token,
|
31
|
+
refresh_token: access_token.refresh_token,
|
32
|
+
expires_at: access_token.expires_at,
|
31
33
|
expires: true
|
32
34
|
}
|
33
35
|
end
|
@@ -38,10 +40,10 @@ module Smileback
|
|
38
40
|
# @param query [Hash] query params; { modified_since: '2017-10-27T07:43:15Z' }
|
39
41
|
# @return [HTTParty::Response]
|
40
42
|
def get(path, query = {})
|
41
|
-
|
43
|
+
access_token.refresh! if access_token.expired?
|
42
44
|
|
43
45
|
self.class.get(path, {
|
44
|
-
headers: { Authorization: "Bearer #{
|
46
|
+
headers: { Authorization: "Bearer #{access_token.token}" },
|
45
47
|
query: query
|
46
48
|
})
|
47
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smileback
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Pheasey
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|