luma 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b6c41b33c30376d3547ffc627ff104117b7fc7de37065b8b37a64fdcd2e06a2
4
- data.tar.gz: 2c1c28940256c86f2183b60b6687e24c55145e6dc07ac65993004264ab4ab59c
3
+ metadata.gz: b2e1eb5f86c6412e81ba1ef33eece2d93a4957779cff5896d39f47245f1dce0e
4
+ data.tar.gz: 6ce4c9f8fc440cbc84f1bb25236eb851e6afa36de504c0cf2390db9af362c0f3
5
5
  SHA512:
6
- metadata.gz: ec9bd186cb7e88d500950a3ad83cf7cebd142501d8d2fc7f9152fb30c14c75d6c12e24a7f23a8d29f6d930db65569c657c26ab01eea3ee2ce36c1ac9d41c2f6e
7
- data.tar.gz: b5d8502b97b32c0be12872ca6fa2b91097a2f42e13e64928f443865d4056d95421f019083e554796c22ee2823e87101bc959b97507e044b1a41ad47480d582a4
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
@@ -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 view_appointment_types(endpoint: APPOINTMENT_TYPE_ENDPOINT, body: nil, headers: {}, auth: true, name: nil, description: nil)
22
- if auth
23
- body = body.to_json
24
- headers = auth_header.merge(headers)
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
@@ -1,3 +1,3 @@
1
1
  module Luma
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.3'.freeze
3
3
  end
data/lib/luma.rb CHANGED
@@ -4,6 +4,8 @@ require 'luma/version'
4
4
  require 'luma/luma_exception'
5
5
  require 'luma/connection'
6
6
  require 'luma/authentication'
7
+ require 'luma/provider'
8
+ require 'luma/appointment_type'
7
9
 
8
10
  module Luma
9
11
  class Configuration
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.2
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-26 00:00:00.000000000 Z
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