luma 0.1.4 → 0.2.0
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 +4 -4
- data/CHANGELOG.md +9 -0
- data/lib/luma/appointment.rb +8 -16
- data/lib/luma/appointment_type.rb +13 -16
- data/lib/luma/connection.rb +10 -3
- data/lib/luma/facilities.rb +7 -10
- data/lib/luma/patient.rb +4 -13
- data/lib/luma/provider.rb +7 -11
- data/lib/luma/response_data.rb +23 -0
- data/lib/luma/version.rb +1 -1
- data/lib/luma.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0a5471261caf0a2f46a1277261a6311ec609aadadd957384c796845467e4442
|
4
|
+
data.tar.gz: 442634ebdd3d19176a7a15f9aec977ca251216bdf972c47f024455eb4dcbc7c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 140255c76810710c84e041a9d91d17daf0d62d2d12deebbe4f25a511a91ca9a12528faa6d82951c62e02ec405bcfe100c5bec35b37def6c3a648e58f179db579
|
7
|
+
data.tar.gz: 504ccc244d416918a8e9f89990935db20e1770ca857178d745daa0c2168376d2c18f3d6b0e55d03e87b3b0be9c33af86cd5e9de3c4faceaebb8578a8387c554a
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@ 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.2.0] - 2022-05-04
|
7
|
+
|
8
|
+
### Added
|
9
|
+
- Luma::ResponseData object with recommend_retry? method
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
- Updated requests to return Luma::ResponseData object
|
13
|
+
|
6
14
|
## [0.1.4] - 2022-02-15
|
7
15
|
|
8
16
|
### Changed
|
@@ -87,6 +95,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
87
95
|
|
88
96
|
- Initial Create
|
89
97
|
|
98
|
+
[0.2.0]: https://github.com/WeInfuse/luma/compare/v0.1.4...v0.2.0
|
90
99
|
[0.1.4]: https://github.com/WeInfuse/luma/compare/v0.1.3...v0.1.4
|
91
100
|
[0.1.3]: https://github.com/WeInfuse/luma/compare/v0.1.2...v0.1.3
|
92
101
|
[0.1.2]: https://github.com/WeInfuse/luma/compare/v0.1.1...v0.1.2
|
data/lib/luma/appointment.rb
CHANGED
@@ -1,23 +1,15 @@
|
|
1
1
|
module Luma
|
2
2
|
class Appointment < Connection
|
3
|
-
|
3
|
+
APPOINTMENT_ENDPOINT = '/api/appointments'.freeze
|
4
4
|
|
5
|
-
|
5
|
+
base_uri 'https://api.lumahealth.io/'.freeze
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
def create_appointment(endpoint: APPOINTMENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout)
|
8
|
+
luma_request(auth: auth, body: body, endpoint: endpoint, verb: verb)
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
def update_appointment(appt_identifier, endpoint: APPOINTMENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout)
|
15
|
-
@body = body
|
16
|
-
self.add_headers_and_body if auth
|
17
|
-
|
18
|
-
endpoint = "#{endpoint}/#{appt_identifier}"
|
19
|
-
|
20
|
-
self.class.send(verb.to_s, endpoint, body: @body, headers: @headers)
|
21
|
-
end
|
11
|
+
def update_appointment(appt_identifier, endpoint: APPOINTMENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout)
|
12
|
+
luma_request(auth: auth, body: body, endpoint: endpoint, identifier: appt_identifier, verb: :put)
|
13
|
+
end
|
22
14
|
end
|
23
15
|
end
|
@@ -1,23 +1,20 @@
|
|
1
1
|
module Luma
|
2
|
-
|
3
|
-
|
2
|
+
class AppointmentType < Connection
|
3
|
+
APPOINTMENT_TYPE_ENDPOINT = '/api/appointmentTypes'.freeze
|
4
4
|
|
5
|
-
|
5
|
+
base_uri 'https://api.lumahealth.io/'.freeze
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
def view_appointment_types(endpoint: APPOINTMENT_TYPE_ENDPOINT, auth: true, name: nil, description: nil, debug_output: $stdout)
|
8
|
+
self.add_header if auth
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
url = "api/appointmentTypes?name=#{name}&description=#{description}"
|
11
|
+
full_url = "https://api.lumahealth.io/" + url
|
12
12
|
|
13
|
-
|
14
|
-
|
13
|
+
HTTParty.get(full_url.to_str, headers: @headers, debug_output: $stdout)
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
self.class.send(verb.to_s, endpoint, body: @body, headers: @headers, debug_output: $stdout)
|
21
|
-
end
|
22
|
-
end
|
16
|
+
def create_appointment_type(endpoint: APPOINTMENT_TYPE_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout)
|
17
|
+
luma_request(auth: auth, body: body, endpoint: endpoint, verb: verb)
|
18
|
+
end
|
19
|
+
end
|
23
20
|
end
|
data/lib/luma/connection.rb
CHANGED
@@ -24,12 +24,19 @@ module Luma
|
|
24
24
|
self.class.send("#{verb}", endpoint, body: body, headers: headers)
|
25
25
|
end
|
26
26
|
|
27
|
-
def
|
28
|
-
@body = @body.to_json
|
29
|
-
@headers = auth_header.merge(@headers)
|
27
|
+
def add_header
|
30
28
|
@headers["Content-Type"] = 'application/json'
|
31
29
|
end
|
32
30
|
|
31
|
+
def luma_request(auth:, body:, endpoint:, verb:, identifier: nil)
|
32
|
+
@body = body
|
33
|
+
self.add_header if auth
|
34
|
+
|
35
|
+
endpoint = "#{endpoint}/#{identifier}" unless identifier.nil?
|
36
|
+
|
37
|
+
Luma::ResponseData.new(response: self.request(endpoint: endpoint, body: @body, headers: @headers, auth: auth, verb: verb))
|
38
|
+
end
|
39
|
+
|
33
40
|
private
|
34
41
|
|
35
42
|
def auth_header
|
data/lib/luma/facilities.rb
CHANGED
@@ -1,14 +1,11 @@
|
|
1
1
|
module Luma
|
2
|
-
|
3
|
-
|
2
|
+
class Facilities < Connection
|
3
|
+
FACILITY_ENDPOINT = '/api/facilities'.freeze
|
4
4
|
|
5
|
-
|
5
|
+
base_uri 'https://api.lumahealth.io/'.freeze
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
self.class.send(verb.to_s, endpoint, body: @body, headers: @headers)
|
12
|
-
end
|
13
|
-
end
|
7
|
+
def create_facility(endpoint: FACILITY_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout)
|
8
|
+
luma_request(auth: auth, body: body, endpoint: endpoint, verb: verb)
|
9
|
+
end
|
10
|
+
end
|
14
11
|
end
|
data/lib/luma/patient.rb
CHANGED
@@ -5,28 +5,19 @@ module Luma
|
|
5
5
|
base_uri 'https://api.lumahealth.io/'.freeze
|
6
6
|
|
7
7
|
def create_patient(endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout)
|
8
|
-
|
9
|
-
self.add_headers_and_body if auth
|
10
|
-
|
11
|
-
self.class.send(verb.to_s, endpoint, body: @body, headers: @headers)
|
8
|
+
luma_request(auth: auth, body: body, endpoint: endpoint, verb: verb)
|
12
9
|
end
|
13
10
|
|
14
11
|
def update_patient(identifier:, endpoint: PATIENT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :put, debug_output: $stdout)
|
15
|
-
|
16
|
-
self.add_headers_and_body if auth
|
17
|
-
|
18
|
-
endpoint = "#{endpoint}/#{identifier}"
|
19
|
-
|
20
|
-
self.class.send(verb.to_s, endpoint, body: @body, headers: @headers)
|
12
|
+
luma_request(auth: auth, body: body, endpoint: endpoint, identifier: identifier, verb: verb)
|
21
13
|
end
|
22
14
|
|
23
15
|
def get_patient(identifier:, endpoint: PATIENT_ENDPOINT, headers: {}, auth: true, verb: :get, debug_output: $stdout)
|
24
|
-
self.
|
16
|
+
self.add_header if auth
|
25
17
|
|
26
18
|
endpoint = "#{endpoint}/#{identifier}"
|
27
19
|
|
28
|
-
response = self.
|
29
|
-
|
20
|
+
response = self.request(endpoint: endpoint, headers: @headers, auth: auth, verb: verb)
|
30
21
|
Luma::Models::PatientResponse.new(response: response)
|
31
22
|
end
|
32
23
|
end
|
data/lib/luma/provider.rb
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
module Luma
|
2
|
-
|
3
|
-
|
2
|
+
class Provider < Connection
|
3
|
+
PROVIDER_ENDPOINT = '/api/providers'.freeze
|
4
4
|
|
5
|
-
|
5
|
+
base_uri 'https://api.lumahealth.io/'.freeze
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
self.class.send(verb.to_s, endpoint, body: @body, headers: @headers, debug_output: $stdout)
|
13
|
-
end
|
14
|
-
end
|
7
|
+
def create_provider(endpoint: PROVIDER_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post)
|
8
|
+
luma_request(auth: auth, body: body, endpoint: endpoint, verb: verb)
|
9
|
+
end
|
10
|
+
end
|
15
11
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Luma
|
2
|
+
class ResponseData
|
3
|
+
attr_reader :response, :raw
|
4
|
+
|
5
|
+
BAD_GATEWAY_CODE = 502.freeze
|
6
|
+
RETRYABLE_CODES = [BAD_GATEWAY_CODE].freeze
|
7
|
+
|
8
|
+
def initialize(response: nil)
|
9
|
+
@response = response
|
10
|
+
|
11
|
+
begin
|
12
|
+
@raw ||= response&.parsed_response
|
13
|
+
rescue JSON::ParserError
|
14
|
+
end
|
15
|
+
|
16
|
+
@raw ||= {}
|
17
|
+
end
|
18
|
+
|
19
|
+
def recommend_retry?
|
20
|
+
return true if RETRYABLE_CODES.include? response.code
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/luma/version.rb
CHANGED
data/lib/luma.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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angela Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- lib/luma/models/patient_response.rb
|
169
169
|
- lib/luma/patient.rb
|
170
170
|
- lib/luma/provider.rb
|
171
|
+
- lib/luma/response_data.rb
|
171
172
|
- lib/luma/version.rb
|
172
173
|
- luma.gemspec
|
173
174
|
homepage: https://github.com/WeInfuse/luma
|