updox 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/README.md +2 -2
- data/lib/updox/models/application.rb +1 -1
- data/lib/updox/models/appointment.rb +16 -1
- data/lib/updox/models/auth.rb +4 -4
- data/lib/updox/models/calendar.rb +24 -3
- data/lib/updox/models/location.rb +2 -2
- data/lib/updox/models/model.rb +10 -0
- data/lib/updox/models/patient.rb +5 -1
- data/lib/updox/models/practice.rb +3 -3
- data/lib/updox/models/user.rb +3 -3
- data/lib/updox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 012ec2142bd40cd1717538f15d9c20d93020c63526bd6ef6db06ede30596dd75
|
4
|
+
data.tar.gz: 676af6481645729aaf1c9ecdd187185c853203174ead58120375de8d4322a362
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce55c116e9a6f25022a2515194c16fc894f6cc60218971cbe22cded9d85f17184080b1056e22f9c65d9e95bb1ef79b3c241ef8216f37dc8e52de8a21a1f3d51e
|
7
|
+
data.tar.gz: 202765e4aba6a39adc1e99f7bbb67b7d5366d87b74c298bd3ed8f26d85bd3e251f75d38b33e02e6197f631e59109a896c977a08524818e21c7c81c7365e30a33
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
|
|
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
6
|
|
7
|
+
## [0.6.0] - 2020-02-13
|
8
|
+
### Added
|
9
|
+
- Calendar#query
|
10
|
+
- Calendar#find
|
11
|
+
- Calendar#exists?
|
12
|
+
- Patient#exists?
|
13
|
+
- Appointment#query
|
14
|
+
- Appointment#find
|
15
|
+
- Appointment#exists?
|
16
|
+
- Models now have `error_message` class that returns string with code and message
|
17
|
+
|
18
|
+
### Changed
|
19
|
+
- All models now return and instance of `Model` for consistency
|
20
|
+
|
7
21
|
## [0.5.0] - 2020-02-13
|
8
22
|
### Added
|
9
23
|
- Practice#find
|
@@ -38,6 +52,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
38
52
|
### Added
|
39
53
|
- Initial Release with ability to ping Updox api
|
40
54
|
|
55
|
+
[0.6.0]: https://github.com/WeInfuse/updox/compare/v0.5.0...v0.6.0
|
41
56
|
[0.5.0]: https://github.com/WeInfuse/updox/compare/v0.4.0...v0.5.0
|
42
57
|
[0.4.0]: https://github.com/WeInfuse/updox/compare/v0.3.0...v0.4.0
|
43
58
|
[0.3.0]: https://github.com/WeInfuse/updox/compare/v0.2.0...v0.3.0
|
data/README.md
CHANGED
@@ -52,7 +52,6 @@ practices = Updox::Models::Practice.query.practices
|
|
52
52
|
practice = Updox::Models::Practice.find('0001')
|
53
53
|
```
|
54
54
|
|
55
|
-
|
56
55
|
### Location
|
57
56
|
|
58
57
|
#### Create
|
@@ -84,7 +83,7 @@ end
|
|
84
83
|
```
|
85
84
|
|
86
85
|
#### Exists?
|
87
|
-
See note on #find method about caching
|
86
|
+
See note on [Location#find](#location_find) method about caching
|
88
87
|
|
89
88
|
```ruby
|
90
89
|
Updox::Models::Location.exists?(27, account_id: '0001')
|
@@ -97,6 +96,7 @@ end
|
|
97
96
|
```
|
98
97
|
|
99
98
|
### Calendar
|
99
|
+
See [Location](#location) for simliar #query, #find and #exists? methods
|
100
100
|
|
101
101
|
#### Create
|
102
102
|
|
@@ -18,7 +18,7 @@ module Updox
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def open(account_id: , user_id: )
|
21
|
-
|
21
|
+
self.class.request(endpoint: OPEN_ENDPOINT, auth: {accountId: account_id, userId: user_id}, required_auths: Updox::Models::Auth::AUTH_FULL)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -2,6 +2,7 @@ module Updox
|
|
2
2
|
module Models
|
3
3
|
class Appointment < Model
|
4
4
|
SYNC_ENDPOINT = '/AppointmentsSync'.freeze
|
5
|
+
LIST_ENDPOINT = '/AppointmentStatusesGetByIds'.freeze
|
5
6
|
|
6
7
|
property :id, required: true
|
7
8
|
property :updoxId, from: :updox_id
|
@@ -36,8 +37,22 @@ module Updox
|
|
36
37
|
self.class.sync([self], account_id: account_id)
|
37
38
|
end
|
38
39
|
|
40
|
+
def self.exists?(appointment_id, account_id: , cached_query: nil)
|
41
|
+
false == self.find(appointment_id, account_id: account_id, cached_query: cached_query).nil?
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.find(appointment_id, account_id: , cached_query: nil)
|
45
|
+
obj = cached_query || self.query([appointment_id], account_id: account_id)
|
46
|
+
|
47
|
+
obj.item['appointmentStatuses'].find {|appointment| appointment_id.to_s == appointment[:externalAppointmentId].to_s }
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.query(appointment_ids, account_id: , active_only: false)
|
51
|
+
request(endpoint: LIST_ENDPOINT, body: { apopintmentIds: appointment_ids }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
|
52
|
+
end
|
53
|
+
|
39
54
|
def self.sync(appointments, account_id: )
|
40
|
-
|
55
|
+
request(endpoint: SYNC_ENDPOINT, body: { appointments: appointments.map(&:to_h) }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
|
41
56
|
end
|
42
57
|
end
|
43
58
|
end
|
data/lib/updox/models/auth.rb
CHANGED
@@ -26,19 +26,19 @@ module Updox
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def ping
|
29
|
-
|
29
|
+
Model.request(endpoint: PING_ENDPOINT, auth: self)
|
30
30
|
end
|
31
31
|
|
32
32
|
def ping_with_application_auth
|
33
|
-
|
33
|
+
Model.request(endpoint: PING_APP_ENDPOINT, auth: self, required_auths: AUTH_APP)
|
34
34
|
end
|
35
35
|
|
36
36
|
def ping_with_account_auth
|
37
|
-
|
37
|
+
Model.request(endpoint: PING_ACCT_ENDPOINT, auth: self, required_auths: AUTH_ACCT)
|
38
38
|
end
|
39
39
|
|
40
40
|
def ping_with_full_auth
|
41
|
-
|
41
|
+
Model.request(endpoint: PING_FULL_ENDPOINT, auth: self, required_auths: AUTH_FULL)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
end
|
@@ -2,21 +2,42 @@ module Updox
|
|
2
2
|
module Models
|
3
3
|
class Calendar < Model
|
4
4
|
SYNC_ENDPOINT = '/CalendarsSync'.freeze
|
5
|
+
LIST_ENDPOINT = '/PracticeCalendarsRetrieve'.freeze
|
6
|
+
|
7
|
+
LIST_TYPE = 'calendars'
|
8
|
+
LIST_NAME = LIST_TYPE
|
5
9
|
|
6
10
|
property :id, required: true
|
7
11
|
property :title, required: true
|
8
|
-
property :color, required: true, default: '#
|
9
|
-
property :textColor, required: true, from: :text_color, default: '#
|
12
|
+
property :color, required: true, default: '#3AC'
|
13
|
+
property :textColor, required: true, from: :text_color, default: '#000'
|
10
14
|
property :publicCalendar, default: false, from: :public_calendar
|
11
15
|
property :active, default: true
|
12
16
|
property :reminderTurnOff, default: false, from: :reminder_turn_off
|
13
17
|
|
18
|
+
# This is only on response
|
19
|
+
property :external_id, from: :externalId
|
20
|
+
|
14
21
|
alias_method :text_color, :textColor
|
15
22
|
alias_method :public_calendar, :publicCalendar
|
16
23
|
alias_method :reminder_turn_off, :reminderTurnOff
|
17
24
|
|
18
25
|
def create(account_id: )
|
19
|
-
self.class.
|
26
|
+
self.class.request(endpoint: SYNC_ENDPOINT, body: self.to_h, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.exists?(calendar_id, account_id: , cached_query: nil)
|
30
|
+
false == self.find(calendar_id, account_id: account_id, cached_query: cached_query).nil?
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.find(calendar_id, account_id: , cached_query: nil)
|
34
|
+
obj = cached_query || self.query(account_id: account_id)
|
35
|
+
|
36
|
+
obj.calendars.find {|calendar| calendar_id.to_s == calendar.external_id.to_s }
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.query(account_id: , active_only: false)
|
40
|
+
request(endpoint: LIST_ENDPOINT, body: { activeOnly: active_only }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
|
20
41
|
end
|
21
42
|
end
|
22
43
|
end
|
@@ -48,11 +48,11 @@ module Updox
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.query(account_id: , active_only: false)
|
51
|
-
|
51
|
+
request(endpoint: LIST_ENDPOINT, body: { activeOnly: active_only }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.sync(locations, account_id: )
|
55
|
-
|
55
|
+
request(endpoint: SYNC_ENDPOINT, body: { locations: locations }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
data/lib/updox/models/model.rb
CHANGED
@@ -2,6 +2,8 @@ module Updox
|
|
2
2
|
module Models
|
3
3
|
DATETIME_FORMAT = '%Y-%m-%d %H:%M'.freeze
|
4
4
|
|
5
|
+
#BATCH_SIZE = 200
|
6
|
+
|
5
7
|
class Model < Hashie::Trash
|
6
8
|
include Hashie::Extensions::IgnoreUndeclared
|
7
9
|
include Hashie::Extensions::IndifferentAccess
|
@@ -26,6 +28,14 @@ module Updox
|
|
26
28
|
self[:updox_status].dig('responseMessage')
|
27
29
|
end
|
28
30
|
|
31
|
+
def error_message
|
32
|
+
"#{response_code}: #{response_message}"
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.request(**kwargs)
|
36
|
+
from_response(UpdoxClient.connection.request(kwargs))
|
37
|
+
end
|
38
|
+
|
29
39
|
def self.from_response(response, klazz = self)
|
30
40
|
return response if false == Updox.configuration.parse_responses?
|
31
41
|
|
data/lib/updox/models/patient.rb
CHANGED
@@ -31,8 +31,12 @@ module Updox
|
|
31
31
|
self.class.sync([self], account_id: account_id)
|
32
32
|
end
|
33
33
|
|
34
|
+
def self.exists?(patient_id, account_id: )
|
35
|
+
request(endpoint: MESSAGE_COUNT_ENDPOINT, body: { patientId: patient_id }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT).successful?
|
36
|
+
end
|
37
|
+
|
34
38
|
def self.sync(patients, account_id: )
|
35
|
-
|
39
|
+
request(endpoint: SYNC_ENDPOINT, body: { patients: patients }, auth: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
|
36
40
|
end
|
37
41
|
end
|
38
42
|
end
|
@@ -36,7 +36,7 @@ module Updox
|
|
36
36
|
alias_method :zip, :postal
|
37
37
|
|
38
38
|
def create
|
39
|
-
|
39
|
+
self.class.request(endpoint: CREATE_ENDPOINT, body: self.to_h, required_auths: Updox::Models::Auth::AUTH_APP)
|
40
40
|
end
|
41
41
|
|
42
42
|
def self.exists?(account_id)
|
@@ -44,11 +44,11 @@ module Updox
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def self.find(account_id)
|
47
|
-
|
47
|
+
request(endpoint: FIND_ENDPOINT, body: {accountId: account_id}, required_auths: Updox::Models::Auth::AUTH_APP)
|
48
48
|
end
|
49
49
|
|
50
50
|
def self.query
|
51
|
-
|
51
|
+
request(endpoint: QUERY_ENDPOINT, required_auths: Updox::Models::Auth::AUTH_APP)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
data/lib/updox/models/user.rb
CHANGED
@@ -31,15 +31,15 @@ module Updox
|
|
31
31
|
alias_method :login_password, :loginPassword
|
32
32
|
|
33
33
|
def create
|
34
|
-
|
34
|
+
self.class.request(endpoint: SAVE_ENDPOINT, body: self.to_h, required_auths: Updox::Models::Auth::AUTH_APP)
|
35
35
|
end
|
36
36
|
|
37
37
|
def self.find(user_id, account_id: )
|
38
|
-
|
38
|
+
request(endpoint: FIND_ENDPOINT, account_id: account_id, body: { userId: user_id}, required_auths: Updox::Models::Auth::AUTH_ACCT)
|
39
39
|
end
|
40
40
|
|
41
41
|
def self.query
|
42
|
-
|
42
|
+
request(endpoint: QUERY_ENDPOINT, required_auths: Updox::Models::Auth::AUTH_APP)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/lib/updox/version.rb
CHANGED