luma 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/luma/authentication.rb +25 -10
- data/lib/luma/connection.rb +1 -2
- data/lib/luma/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31e15523557fdb75d2fc4884ed91488fcbce40cfc380d346a70d1aa725fcc510
|
4
|
+
data.tar.gz: 48106270eb2c8b3f9cdca4abd859c9ef3516545cb43a253277fe906514728d0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51a4eb724be12656f1fb90ba7458724812db5a5fa7649dffd10e98c45cdb929586d2e1b8b156eac188dc21e6f429f439b82122b50e9af70abb0cd96e31f8a73e
|
7
|
+
data.tar.gz: 1bc827dff83cc98e23f1caf966802f0f886a858fbca374c124e923ce83d34eddb24e2967fa33b3de0015bba5025cf58ab4245cd44a8f0408cece7f13e0823bd0
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@ All notable changes to this project will be documented in this file.
|
|
3
3
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
6
|
+
## [0.1.4] - 2022-02-15
|
7
|
+
|
8
|
+
### Changed
|
9
|
+
|
10
|
+
- Authentication accounts for token expiration
|
11
|
+
- Connection memoizes authentication
|
12
|
+
|
6
13
|
## [0.1.3] - 2022-02-10
|
7
14
|
|
8
15
|
### Changed
|
@@ -80,6 +87,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
80
87
|
|
81
88
|
- Initial Create
|
82
89
|
|
90
|
+
[0.1.4]: https://github.com/WeInfuse/luma/compare/v0.1.3...v0.1.4
|
83
91
|
[0.1.3]: https://github.com/WeInfuse/luma/compare/v0.1.2...v0.1.3
|
84
92
|
[0.1.2]: https://github.com/WeInfuse/luma/compare/v0.1.1...v0.1.2
|
85
93
|
[0.1.1]: https://github.com/WeInfuse/luma/compare/v0.1.0...v0.1.1
|
data/lib/luma/authentication.rb
CHANGED
@@ -14,18 +14,21 @@ module Luma
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def authenticate
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
if (self.expires?)
|
18
|
+
request = {
|
19
|
+
body: { email: email, password: password },
|
20
|
+
endpoint: AUTH_ENDPOINT
|
21
|
+
}
|
21
22
|
|
22
|
-
|
23
|
+
response = self.request(**request, auth: false)
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
25
|
+
if (false == response.ok?)
|
26
|
+
@response = nil
|
27
|
+
raise LumaException.from_response(response, msg: 'Authentication')
|
28
|
+
else
|
29
|
+
@response = response
|
30
|
+
validate
|
31
|
+
end
|
29
32
|
end
|
30
33
|
|
31
34
|
return self
|
@@ -51,6 +54,18 @@ module Luma
|
|
51
54
|
return @response['token'] if @response
|
52
55
|
end
|
53
56
|
|
57
|
+
def expiry
|
58
|
+
return @validation_response['exp'] if @validation_response
|
59
|
+
end
|
60
|
+
|
61
|
+
def expires?
|
62
|
+
if (self.expiry)
|
63
|
+
return (self.expiry / 1000) <= Time.now.to_f.floor
|
64
|
+
else
|
65
|
+
return true
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
54
69
|
def access_header
|
55
70
|
return {
|
56
71
|
'X-Access-Token' => self.access_token,
|
data/lib/luma/connection.rb
CHANGED
data/lib/luma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: luma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angela Rodriguez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -142,7 +142,7 @@ dependencies:
|
|
142
142
|
- - ">="
|
143
143
|
- !ruby/object:Gem::Version
|
144
144
|
version: '0'
|
145
|
-
description:
|
145
|
+
description:
|
146
146
|
email:
|
147
147
|
- angela.rodriguez@weinfuse.com
|
148
148
|
executables: []
|
@@ -175,7 +175,7 @@ licenses:
|
|
175
175
|
- MIT
|
176
176
|
metadata:
|
177
177
|
allowed_push_host: https://rubygems.org
|
178
|
-
post_install_message:
|
178
|
+
post_install_message:
|
179
179
|
rdoc_options: []
|
180
180
|
require_paths:
|
181
181
|
- lib
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
193
|
rubygems_version: 3.1.4
|
194
|
-
signing_key:
|
194
|
+
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: Ruby wrapper for the Luma Health API
|
197
197
|
test_files: []
|