athena_health 0.7.0 → 0.8.0

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: 09b761c82a6c988c162456d1482d75ef2260d967
4
- data.tar.gz: 1dfbea79cd481005442e4c89515fc615e28b2c91
3
+ metadata.gz: 7881cc0588d6015a9a53c862b7f649f2122dfe59
4
+ data.tar.gz: b900327914967d1cb109f20e7d50deca7cb5dc4a
5
5
  SHA512:
6
- metadata.gz: 01e173821a99b9938ee1bacf4d3f2499ba3340d047e75f5339a2af43f6ba54cf01554a158bd07976a5731bdb317bff5b7078453fa9b7dfd083ca854be6a42742
7
- data.tar.gz: 55f7252abced9c1e3183d63b2d8ffea38baa2d8a91e20a59417380232d740352099e3a7e2c644431324f8a1616e33e10608394fbcd0ca61cd54391fa30194ef1
6
+ metadata.gz: 369d50e447b3f086810b43ff63c29e2c64528066053a4fba3d83e30b7797876fcc97f1c884e7227e076fe4724ddd484b36809a356f89deb763e8fcc33b7fd626
7
+ data.tar.gz: cd27f1f6deb648bc09ea6bdd14734247baeed69c9f3a7b8d655c4bcad2b596c729827d942459a3ee1db300a65cd88d842d364f2e16db401d9f2b8199639d210d
data/lib/athena_health.rb CHANGED
@@ -7,6 +7,8 @@ require 'athena_health/error'
7
7
  require 'athena_health/endpoints/practices'
8
8
  require 'athena_health/endpoints/departments'
9
9
  require 'athena_health/endpoints/patients'
10
+ require 'athena_health/endpoints/appointments'
11
+ require 'athena_health/endpoints/providers'
10
12
  require 'athena_health/client'
11
13
  require 'athena_health/base_collection'
12
14
  require 'athena_health/base_model'
@@ -20,6 +22,12 @@ require 'athena_health/patient_collection'
20
22
  require 'athena_health/event'
21
23
  require 'athena_health/patient_problem'
22
24
  require 'athena_health/patient_problem_collection'
25
+ require 'athena_health/provider'
26
+ require 'athena_health/provider_collection'
27
+ require 'athena_health/appointment_type'
28
+ require 'athena_health/appointment_type_collection'
29
+ require 'athena_health/appointment'
30
+ require 'athena_health/appointment_collection'
23
31
 
24
32
  module AthenaHealth
25
33
  end
@@ -0,0 +1,13 @@
1
+ module AthenaHealth
2
+ class Appointment < BaseModel
3
+ attribute :date, String
4
+ attribute :appointmentid, Integer
5
+ attribute :departmentid, Integer
6
+ attribute :appointmenttype, String
7
+ attribute :providerid, Integer
8
+ attribute :starttime, String
9
+ attribute :duration, Integer
10
+ attribute :appointmenttypeid, Integer
11
+ attribute :patientappointmenttypename, Integer
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module AthenaHealth
2
+ class AppointmentCollection < BaseCollection
3
+ attribute :appointments, Array[Appointment]
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ module AthenaHealth
2
+ class AppointmentType < BaseModel
3
+ attribute :shortname, String
4
+ attribute :name, String
5
+ attribute :duration, Integer
6
+ attribute :patientdisplayname, String
7
+ attribute :appointmenttypeid, Integer
8
+ attribute :generic, Boolean
9
+ attribute :patient, Boolean
10
+ attribute :publicnames, Array
11
+ attribute :templatetypeonly, Boolean
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ module AthenaHealth
2
+ class AppointmentTypeCollection < BaseCollection
3
+ attribute :appointmenttypes, Array[AppointmentType]
4
+
5
+ alias_method :appointment_types, :appointmenttypes
6
+ end
7
+ end
@@ -7,5 +7,7 @@ module AthenaHealth
7
7
  include Endpoints::Practices
8
8
  include Endpoints::Departments
9
9
  include Endpoints::Patients
10
+ include Endpoints::Appointments
11
+ include Endpoints::Providers
10
12
  end
11
13
  end
@@ -0,0 +1,25 @@
1
+ module AthenaHealth
2
+ module Endpoints
3
+ module Appointments
4
+ def all_appointment_types(practice_id:, params: {})
5
+ response = @api.call(
6
+ endpoint: "#{practice_id}/appointmenttypes",
7
+ method: :get,
8
+ params: params
9
+ )
10
+
11
+ AppointmentTypeCollection.new(response)
12
+ end
13
+
14
+ def open_appointment_slots(practice_id:, department_id:, appointment_type_id:, params: {})
15
+ response = @api.call(
16
+ endpoint: "#{practice_id}/appointments/open",
17
+ method: :get,
18
+ params: params.merge(departmentid: department_id, appointmenttypeid: appointment_type_id)
19
+ )
20
+
21
+ AppointmentCollection.new(response)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,15 @@
1
+ module AthenaHealth
2
+ module Endpoints
3
+ module Providers
4
+ def all_providers(practice_id:, params: {})
5
+ response = @api.call(
6
+ endpoint: "#{practice_id}/providers",
7
+ method: :get,
8
+ params: params
9
+ )
10
+
11
+ ProviderCollection.new(response)
12
+ end
13
+ end
14
+ end
15
+ end
@@ -1,33 +1,29 @@
1
1
  module AthenaHealth
2
+ class UnauthorizedError < StandardError; end
3
+ class IncorrectPermissionsError < StandardError; end
4
+ class ForbiddenError < StandardError; end
5
+ class NotFoundError < StandardError; end
6
+ class ConflictError < StandardError; end
7
+ class InternalServerError < StandardError; end
8
+ class ServiceUnavailableError < StandardError; end
9
+
2
10
  class Error
11
+ ERROR_TYPES = {
12
+ 401 => UnauthorizedError,
13
+ 402 => IncorrectPermissionsError,
14
+ 403 => ForbiddenError,
15
+ 404 => NotFoundError,
16
+ 409 => ConflictError,
17
+ 500 => InternalServerError,
18
+ 503 => ServiceUnavailableError,
19
+ }
20
+
3
21
  def initialize(code:)
4
22
  @code = code
5
23
  end
6
24
 
7
25
  def render
8
- fail errors[@code]
9
- end
10
-
11
- private
12
-
13
- def errors
14
- {
15
- 401 => UnauthorizedError,
16
- 402 => IncorrectPermissionsError,
17
- 403 => ForbiddenError,
18
- 404 => NotFoundError,
19
- 409 => ConflictError,
20
- 500 => InternalServerError,
21
- 503 => ServiceUnavailableError,
22
- }
26
+ fail ERROR_TYPES[@code]
23
27
  end
24
28
  end
25
-
26
- class UnauthorizedError < StandardError; end
27
- class IncorrectPermissionsError < StandardError; end
28
- class ForbiddenError < StandardError; end
29
- class NotFoundError < StandardError; end
30
- class ConflictError < StandardError; end
31
- class InternalServerError < StandardError; end
32
- class ServiceUnavailableError < StandardError; end
33
29
  end
@@ -0,0 +1,20 @@
1
+ module AthenaHealth
2
+ class Provider < BaseModel
3
+ attribute :firstname, String
4
+ attribute :specialty, String
5
+ attribute :homedepartment, String
6
+ attribute :acceptingnewpatients, Boolean
7
+ attribute :providertypeid, Boolean
8
+ attribute :billable, Boolean
9
+ attribute :displayname, String
10
+ attribute :ansinamecode, String
11
+ attribute :lastname, String
12
+ attribute :providerid, Integer
13
+ attribute :providerusername, String
14
+ attribute :ansispecialtycode, String
15
+ attribute :hideinportal, Boolean
16
+ attribute :entitytype, String
17
+ attribute :npi, Integer
18
+ attribute :providertype, String
19
+ end
20
+ end
@@ -0,0 +1,5 @@
1
+ module AthenaHealth
2
+ class ProviderCollection < BaseCollection
3
+ attribute :providers, Array[Provider]
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module AthenaHealth
2
- VERSION = '0.7.0'.freeze
2
+ VERSION = '0.8.0'.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: 0.7.0
4
+ version: 0.8.0
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-02-19 00:00:00.000000000 Z
11
+ date: 2016-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -125,6 +125,10 @@ files:
125
125
  - Rakefile
126
126
  - athena_health.gemspec
127
127
  - lib/athena_health.rb
128
+ - lib/athena_health/appointment.rb
129
+ - lib/athena_health/appointment_collection.rb
130
+ - lib/athena_health/appointment_type.rb
131
+ - lib/athena_health/appointment_type_collection.rb
128
132
  - lib/athena_health/balance.rb
129
133
  - lib/athena_health/base_collection.rb
130
134
  - lib/athena_health/base_model.rb
@@ -132,9 +136,11 @@ files:
132
136
  - lib/athena_health/connection.rb
133
137
  - lib/athena_health/department.rb
134
138
  - lib/athena_health/department_collection.rb
139
+ - lib/athena_health/endpoints/appointments.rb
135
140
  - lib/athena_health/endpoints/departments.rb
136
141
  - lib/athena_health/endpoints/patients.rb
137
142
  - lib/athena_health/endpoints/practices.rb
143
+ - lib/athena_health/endpoints/providers.rb
138
144
  - lib/athena_health/error.rb
139
145
  - lib/athena_health/event.rb
140
146
  - lib/athena_health/patient.rb
@@ -143,6 +149,8 @@ files:
143
149
  - lib/athena_health/patient_problem_collection.rb
144
150
  - lib/athena_health/practice.rb
145
151
  - lib/athena_health/practice_collection.rb
152
+ - lib/athena_health/provider.rb
153
+ - lib/athena_health/provider_collection.rb
146
154
  - lib/athena_health/version.rb
147
155
  homepage: https://github.com/zywy/athena_health
148
156
  licenses: