athena_health 1.0.49 → 1.0.50

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
  SHA256:
3
- metadata.gz: 16f3bbf0c6bb7e2bf629894b4e43693a83be20747d524d8f4574567fc3946fc7
4
- data.tar.gz: 86f799717f6069cc1903d8ff33200a98bf9b9a2bf0d1a9356b4948f99314c168
3
+ metadata.gz: b3f00019546f05d47fd5d66fa4b172be1b4e1201f75cd48c397b6a71c9b6c733
4
+ data.tar.gz: 87ea74a718f602a4cf584fec2799653344b2bcddd90c13dc1deb613db1cf2fc7
5
5
  SHA512:
6
- metadata.gz: 1c6d3ca9810e36409645921112723944f9190a665ec8a307554390979a83fcd04d6ea39229e91e6ee557be4f360527e67fd25ab9970ea665abce69d7515a70be
7
- data.tar.gz: a99ba2785e8be7d86717d2781fa44e4a39653f421e804757b69d6ade1c9b840e5e4f3408062780680eab0ce8375cad6bf9313f7861b92ed174a6b1548d34fae6
6
+ metadata.gz: 56d2c4dc4262c8002a067b6acf1e1680a7cc2fba7485660e9e1cb819706288a3a0763293d9487646ce6eabeb7abbbf787c6e76295a16a345a7d4a873ee688309
7
+ data.tar.gz: 1279e39af9a99ecdf8eec9cbbfd3c49e88114bda330f17ff7e2c5c66d46c9a3f90350083a8d29cbb60c7bc47ca929166c5a3f05553e095b402e12bb8334cf5c0
data/lib/athena_health.rb CHANGED
@@ -12,6 +12,7 @@ require 'athena_health/endpoints/providers'
12
12
  require 'athena_health/endpoints/insurance_packages'
13
13
  require 'athena_health/endpoints/encounters'
14
14
  require 'athena_health/endpoints/configurations'
15
+ require 'athena_health/endpoints/subscriptions'
15
16
  require 'athena_health/client'
16
17
  require 'athena_health/base_collection'
17
18
  require 'athena_health/base_model'
@@ -73,6 +74,7 @@ require 'athena_health/user_medication_event'
73
74
  require 'athena_health/user_medication_sig'
74
75
  require 'athena_health/user_medication'
75
76
  require 'athena_health/user_medication_collection'
77
+ require 'athena_health/subscription'
76
78
 
77
79
  module AthenaHealth
78
80
  end
@@ -17,5 +17,6 @@ module AthenaHealth
17
17
  include Endpoints::InsurancePackages
18
18
  include Endpoints::Encounters
19
19
  include Endpoints::Configurations
20
+ include Endpoints::Subscriptions
20
21
  end
21
22
  end
@@ -2,7 +2,7 @@ module AthenaHealth
2
2
  class Department < BaseModel
3
3
  attribute :creditcardtypes, Array
4
4
  attribute :medicationhistoryconsent, Boolean
5
- attribute :timezoneoffset, Fixnum
5
+ attribute :timezoneoffset, Integer
6
6
  attribute :providergroupid, Integer
7
7
  attribute :singleappointmentcontractmax, Integer
8
8
  attribute :state, String
@@ -18,7 +18,7 @@ module AthenaHealth
18
18
  attribute :placeofservicetypeid, Integer
19
19
  attribute :longitude, Float
20
20
  attribute :clinicals, String
21
- attribute :timezone, Fixnum
21
+ attribute :timezone, Integer
22
22
  attribute :patientdepartmentname, String
23
23
  attribute :name, String
24
24
  attribute :placeofservicetypename, String
@@ -217,26 +217,6 @@ module AthenaHealth
217
217
  InsuranceCollection.new(response)
218
218
  end
219
219
 
220
- def create_appointment_subscription(practice_id:, params: {})
221
- @api.call(
222
- endpoint: "#{practice_id}/appointments/changed/subscription",
223
- method: :post,
224
- params: params
225
- )
226
- end
227
-
228
- def changed_appointments(practice_id:, department_id:, params: {})
229
- response = @api.call(
230
- endpoint: "#{practice_id}/appointments/changed",
231
- method: :get,
232
- params: params.merge!(
233
- departmentid: department_id
234
- )
235
- )
236
-
237
- AppointmentCollection.new(response)
238
- end
239
-
240
220
  def create_appointment_waitlist(practice_id:, params: {})
241
221
  @api.call(
242
222
  endpoint: "#{practice_id}/appointments/waitlist",
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AthenaHealth
4
+ module Endpoints
5
+ module Subscriptions
6
+ SUBSCRIPTION_TYPES = [
7
+ {
8
+ collection_class: 'AppointmentCollection',
9
+ path: 'appointments',
10
+ name: 'appointment',
11
+ plural_name: 'appointments'
12
+ },
13
+ {
14
+ collection_class: 'PatientCollection',
15
+ path: 'patients',
16
+ name: 'patient',
17
+ plural_name: 'patients'
18
+ },
19
+ {
20
+ collection_class: 'ProviderCollection',
21
+ path: 'providers',
22
+ name: 'provider',
23
+ plural_name: 'providers'
24
+ },
25
+ {
26
+ collection_class: 'PatientProblemCollection',
27
+ path: 'chart/healthhistory/problems',
28
+ name: 'patient_problem',
29
+ plural_name: 'patient_problems'
30
+ },
31
+ {
32
+ collection_class: 'UserAllergyCollection',
33
+ path: 'chart/healthhistory/allergies',
34
+ name: 'patient_allergy',
35
+ plural_name: 'patient_allergies'
36
+ },
37
+ {
38
+ collection_class: 'PrescriptionCollection',
39
+ path: 'prescriptions',
40
+ name: 'prescription',
41
+ plural_name: 'prescriptions'
42
+ },
43
+ {
44
+ collection_class: 'UserMedicationCollection',
45
+ path: 'chart/healthhistory/medication',
46
+ name: 'patient_medication',
47
+ plural_name: 'patient_medications'
48
+ },
49
+ {
50
+ collection_class: 'PrescriptionCollection',
51
+ path: 'prescriptions',
52
+ name: 'prescription',
53
+ plural_name: 'prescriptions'
54
+ }
55
+ ].freeze
56
+
57
+ SUBSCRIPTION_TYPES.each do |subscription_type|
58
+ define_method("#{subscription_type[:name]}_subscription") do |practice_id:, params: {}|
59
+ response = @api.call(
60
+ endpoint: "#{practice_id}/#{subscription_type[:path]}/changed/subscription",
61
+ method: :get,
62
+ params: params
63
+ )
64
+
65
+ Subscription.new(response)
66
+ end
67
+
68
+ define_method("create_#{subscription_type[:name]}_subscription") do |practice_id:, params: {}|
69
+ @api.call(
70
+ endpoint: "#{practice_id}/#{subscription_type[:path]}/changed/subscription",
71
+ method: :post,
72
+ params: params
73
+ )
74
+ end
75
+
76
+ define_method("changed_#{subscription_type[:plural_name]}") do |practice_id:, department_id: nil, params: {}|
77
+ params[:departmentid] = department_id unless department_id.nil?
78
+ response = @api.call(
79
+ endpoint: "#{practice_id}/#{subscription_type[:path]}/changed",
80
+ method: :get,
81
+ params: params
82
+ )
83
+ Object.const_get('AthenaHealth').const_get((subscription_type[:collection_class]).to_s).new(response)
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,14 @@
1
+ module AthenaHealth
2
+ class Subscription < BaseModel
3
+ attribute :status, String
4
+ attribute :subscriptions, Array[Hash]
5
+
6
+ def events
7
+ @events ||= subscriptions.map{|s| s["eventname"]}
8
+ end
9
+
10
+ def active?
11
+ @active || status === 'ACTIVE'
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module AthenaHealth
2
- VERSION = '1.0.49'.freeze
2
+ VERSION = '1.0.50'.freeze
3
3
  end
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: 1.0.49
4
+ version: 1.0.50
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: 2019-04-10 00:00:00.000000000 Z
11
+ date: 2020-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -141,6 +141,7 @@ files:
141
141
  - lib/athena_health/endpoints/patients.rb
142
142
  - lib/athena_health/endpoints/practices.rb
143
143
  - lib/athena_health/endpoints/providers.rb
144
+ - lib/athena_health/endpoints/subscriptions.rb
144
145
  - lib/athena_health/error.rb
145
146
  - lib/athena_health/event.rb
146
147
  - lib/athena_health/facility.rb
@@ -175,6 +176,7 @@ files:
175
176
  - lib/athena_health/question_collection.rb
176
177
  - lib/athena_health/reaction.rb
177
178
  - lib/athena_health/social_history.rb
179
+ - lib/athena_health/subscription.rb
178
180
  - lib/athena_health/template.rb
179
181
  - lib/athena_health/user_allergy.rb
180
182
  - lib/athena_health/user_allergy_collection.rb
@@ -202,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
204
  - !ruby/object:Gem::Version
203
205
  version: '0'
204
206
  requirements: []
205
- rubygems_version: 3.0.3
207
+ rubygems_version: 3.1.2
206
208
  signing_key:
207
209
  specification_version: 4
208
210
  summary: Ruby wrapper for Athenahealth API.