athena_health 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 995f91c21aeb1b50ac9b1520e473479b18801758
|
4
|
+
data.tar.gz: ce15b95c8373f5c103a544b036934102b40e1a0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77385cb4805c976a9a1408f466cbd9906de0ebb2ce251e7b2add7345cbe2a214e6f1b65473ff1452e9a34e862d619522a37003ea3d5adb1be0a95103890c5719
|
7
|
+
data.tar.gz: b0d323d4ab1b50e482caf091d8f748649f1db62b4beed968f8938670060d9f92fef7edcb467b652cbe4c6fc10dc1e8fffef1f6dc114a4434d1c1d3b3d7ff1ff3
|
@@ -4,6 +4,8 @@ module AthenaHealth
|
|
4
4
|
attribute :appointmentid, Integer
|
5
5
|
attribute :departmentid, Integer
|
6
6
|
attribute :appointmenttype, String
|
7
|
+
attribute :appointmentstatus, String
|
8
|
+
attribute :patientid, Integer
|
7
9
|
attribute :providerid, Integer
|
8
10
|
attribute :starttime, String
|
9
11
|
attribute :duration, Integer
|
@@ -37,11 +37,17 @@ module AthenaHealth
|
|
37
37
|
call(endpoint: endpoint, method: method, second_call: true)
|
38
38
|
end
|
39
39
|
|
40
|
-
|
40
|
+
body = JSON.parse(response.response_body)
|
41
|
+
|
42
|
+
if [400, 409].include? response.response_code
|
43
|
+
fail AthenaHealth::ValidationError.new(body)
|
44
|
+
end
|
45
|
+
|
46
|
+
if response.response_code != 200
|
41
47
|
AthenaHealth::Error.new(code: response.response_code).render
|
42
48
|
end
|
43
49
|
|
44
|
-
|
50
|
+
body
|
45
51
|
end
|
46
52
|
end
|
47
53
|
end
|
@@ -20,6 +20,16 @@ module AthenaHealth
|
|
20
20
|
|
21
21
|
AppointmentCollection.new(response)
|
22
22
|
end
|
23
|
+
|
24
|
+
def book_appointment(practice_id:, appointment_id:, patient_id:, appointment_type_id:, params: {})
|
25
|
+
response = @api.call(
|
26
|
+
endpoint: "#{practice_id}/appointments/#{appointment_id}",
|
27
|
+
method: :put,
|
28
|
+
params: params.merge(patientid: patient_id, appointmenttypeid: appointment_type_id)
|
29
|
+
)
|
30
|
+
|
31
|
+
Appointment.new(response.first)
|
32
|
+
end
|
23
33
|
end
|
24
34
|
end
|
25
35
|
end
|
data/lib/athena_health/error.rb
CHANGED
@@ -3,17 +3,24 @@ module AthenaHealth
|
|
3
3
|
class IncorrectPermissionsError < StandardError; end
|
4
4
|
class ForbiddenError < StandardError; end
|
5
5
|
class NotFoundError < StandardError; end
|
6
|
-
class ConflictError < StandardError; end
|
7
6
|
class InternalServerError < StandardError; end
|
8
7
|
class ServiceUnavailableError < StandardError; end
|
9
8
|
|
9
|
+
class ValidationError < StandardError
|
10
|
+
attr_reader :details
|
11
|
+
|
12
|
+
def initialize(details)
|
13
|
+
@details = details
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
|
10
18
|
class Error
|
11
19
|
ERROR_TYPES = {
|
12
20
|
401 => UnauthorizedError,
|
13
21
|
402 => IncorrectPermissionsError,
|
14
22
|
403 => ForbiddenError,
|
15
23
|
404 => NotFoundError,
|
16
|
-
409 => ConflictError,
|
17
24
|
500 => InternalServerError,
|
18
25
|
503 => ServiceUnavailableError,
|
19
26
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: athena_health
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Urbański
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|