luma 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/luma/appointment_type.rb +31 -0
- data/lib/luma/connection.rb +9 -24
- data/lib/luma/provider.rb +25 -0
- data/lib/luma/version.rb +1 -1
- data/lib/luma.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2e1eb5f86c6412e81ba1ef33eece2d93a4957779cff5896d39f47245f1dce0e
|
4
|
+
data.tar.gz: 6ce4c9f8fc440cbc84f1bb25236eb851e6afa36de504c0cf2390db9af362c0f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27a8ff325fb761b1debbc632d46745efcdb71401dc31982a8877b9150c7d5a794c1b2ef0f08e9c6a48d162cee19eb6e59c74b80a537debd0a2bf72c019f49431
|
7
|
+
data.tar.gz: 7683fa09e2371979e87955b0d7f3c7c8fe30ac2a74fb4f375445d6f808102011aedb2ffaa25722660cc183ccbfb044a7624cd79f0617cd15dcd75ed507009182
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Luma
|
2
|
+
class AppointmentType < Connection
|
3
|
+
APPOINTMENT_TYPE_ENDPOINT = '/api/appointmentTypes'.freeze
|
4
|
+
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
base_uri 'https://api.lumahealth.io/'.freeze
|
8
|
+
|
9
|
+
headers 'Content-Type' => 'application/json'
|
10
|
+
|
11
|
+
format :json
|
12
|
+
|
13
|
+
def view_appointment_types(endpoint: APPOINTMENT_TYPE_ENDPOINT, auth: true, name: nil, description: nil, debug_output: $stdout)
|
14
|
+
self.add_headers_and_body if auth
|
15
|
+
|
16
|
+
url = "api/appointmentTypes?name=#{name}&description=#{description}"
|
17
|
+
full_url = "https://api.lumahealth.io/" + url
|
18
|
+
|
19
|
+
result = HTTParty.get(full_url.to_str, headers: @headers, debug_output: $stdout)
|
20
|
+
{ result: result, headers: @headers }
|
21
|
+
end
|
22
|
+
|
23
|
+
def create_appointment_type(endpoint: APPOINTMENT_TYPE_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post, debug_output: $stdout)
|
24
|
+
@body = body
|
25
|
+
self.add_headers_and_body if auth
|
26
|
+
|
27
|
+
result = self.class.send(verb.to_s, endpoint, body: @body, headers: @headers, debug_output: $stdout)
|
28
|
+
{ result: result, headers: @headers }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/luma/connection.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Luma
|
2
2
|
class Connection
|
3
3
|
DEFAULT_ENDPOINT = '/endpoint'.freeze
|
4
|
-
APPOINTMENT_TYPE_ENDPOINT = '/api/appointmentTypes'.freeze
|
5
4
|
|
6
5
|
include HTTParty
|
7
6
|
|
@@ -11,6 +10,11 @@ module Luma
|
|
11
10
|
|
12
11
|
format :json
|
13
12
|
|
13
|
+
def initialize(body: nil, headers: {})
|
14
|
+
@body = body
|
15
|
+
@headers = headers
|
16
|
+
end
|
17
|
+
|
14
18
|
def request(endpoint: DEFAULT_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post)
|
15
19
|
body = body.to_json if body.is_a?(Hash)
|
16
20
|
headers = auth_header.merge(headers) if auth
|
@@ -18,29 +22,10 @@ module Luma
|
|
18
22
|
self.class.send("#{verb}", endpoint, body: body, headers: headers)
|
19
23
|
end
|
20
24
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
headers["Content-Type"] = 'application/json'
|
26
|
-
end
|
27
|
-
|
28
|
-
url = "api/appointmentTypes?name=#{name}&description=#{description}"
|
29
|
-
full_url = "https://api.lumahealth.io/" + url
|
30
|
-
|
31
|
-
result = HTTParty.get(full_url.to_str, body: nil, headers: headers, debug_output: $stdout)
|
32
|
-
{ result: result, headers: headers }
|
33
|
-
end
|
34
|
-
|
35
|
-
def create_appointment_type(endpoint: APPOINTMENT_TYPE_ENDPOINT, body: nil, headers: {}, auth: true, verb: :post)
|
36
|
-
if auth
|
37
|
-
body = body.to_json
|
38
|
-
headers = auth_header.merge(headers)
|
39
|
-
headers["Content-Type"] = 'application/json'
|
40
|
-
end
|
41
|
-
|
42
|
-
result = self.class.send(verb.to_s, endpoint, body: body, headers: headers, debug_output: $stdout)
|
43
|
-
{ result: result, headers: headers }
|
25
|
+
def add_headers_and_body
|
26
|
+
@body = @body.to_json
|
27
|
+
@headers = auth_header.merge(@headers)
|
28
|
+
@headers["Content-Type"] = 'application/json'
|
44
29
|
end
|
45
30
|
|
46
31
|
private
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Luma
|
2
|
+
class Provider < Connection
|
3
|
+
PROVIDER_ENDPOINT = '/api/providers'.freeze
|
4
|
+
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
base_uri 'https://api.lumahealth.io/'.freeze
|
8
|
+
|
9
|
+
headers 'Content-Type' => 'application/json'
|
10
|
+
|
11
|
+
format :json
|
12
|
+
|
13
|
+
def create_provider(endpoint: PROVIDER_ENDPOINT, name: "", npi: nil, headers: {}, auth: true, verb: :post)
|
14
|
+
@body = {
|
15
|
+
name: name,
|
16
|
+
npi: npi
|
17
|
+
}
|
18
|
+
|
19
|
+
self.add_headers_and_body if auth
|
20
|
+
|
21
|
+
result = self.class.send(verb.to_s, endpoint, body: @body, headers: @headers, debug_output: $stdout)
|
22
|
+
{ result: result, headers: @headers }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
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.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angela Rodriguez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -141,9 +141,11 @@ files:
|
|
141
141
|
- README.md
|
142
142
|
- Rakefile
|
143
143
|
- lib/luma.rb
|
144
|
+
- lib/luma/appointment_type.rb
|
144
145
|
- lib/luma/authentication.rb
|
145
146
|
- lib/luma/connection.rb
|
146
147
|
- lib/luma/luma_exception.rb
|
148
|
+
- lib/luma/provider.rb
|
147
149
|
- lib/luma/version.rb
|
148
150
|
- luma.gemspec
|
149
151
|
homepage: https://github.com/WeInfuse/luma
|