athena_health 1.0.48 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +32 -0
- data/.ruby-version +1 -0
- data/README.md +59 -2
- data/athena_health.gemspec +1 -1
- data/lib/athena_health.rb +8 -0
- data/lib/athena_health/claim/claim.rb +30 -0
- data/lib/athena_health/claim/claim_collection.rb +9 -0
- data/lib/athena_health/claim/diagnosis.rb +14 -0
- data/lib/athena_health/claim/payer.rb +17 -0
- data/lib/athena_health/claim/procedure.rb +16 -0
- data/lib/athena_health/client.rb +6 -3
- data/lib/athena_health/connection.rb +17 -10
- data/lib/athena_health/custom_field.rb +17 -0
- data/lib/athena_health/custom_field_data.rb +7 -0
- data/lib/athena_health/department.rb +2 -2
- data/lib/athena_health/endpoints/appointments.rb +0 -20
- data/lib/athena_health/endpoints/claims.rb +17 -0
- data/lib/athena_health/endpoints/custom_fields.rb +16 -0
- data/lib/athena_health/endpoints/encounters.rb +16 -0
- data/lib/athena_health/endpoints/patients.rb +8 -0
- data/lib/athena_health/endpoints/subscriptions.rb +94 -0
- data/lib/athena_health/subscription.rb +14 -0
- data/lib/athena_health/version.rb +1 -1
- metadata +21 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 770807e4bf3b5d93401d26193dbb62d5a08bc1aa920c09f2912759ae1a664800
|
4
|
+
data.tar.gz: 118ffe8282b8e6d7883a748deda6fa2ce11c5b5cbb963b75bf75e6d76d1a220e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0950f98045fcd302746921577823ddb7e3cf4deeb3c93f67ba7842d0c8bb4447eecdf02d068b77fa50a2befabe538bdde158fa7236b60a09f155ef80231f2a91'
|
7
|
+
data.tar.gz: 46da095cbeddb4fdd552ad7932388185166b3ad867c67bf5c07deaf02e55727c67394e141a7babfcedbdf5f2c44f1656afffcd87400e5471a886e6106a25ec21
|
@@ -0,0 +1,32 @@
|
|
1
|
+
name: Continuous integration
|
2
|
+
on: push
|
3
|
+
|
4
|
+
jobs:
|
5
|
+
verify:
|
6
|
+
name: Build
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
|
9
|
+
steps:
|
10
|
+
- name: Checkout code
|
11
|
+
uses: actions/checkout@v2
|
12
|
+
|
13
|
+
- name: Set up Ruby
|
14
|
+
uses: ruby/setup-ruby@v1
|
15
|
+
with:
|
16
|
+
ruby-version: 3.0.1
|
17
|
+
|
18
|
+
- name: Ruby gem cache
|
19
|
+
uses: actions/cache@v2
|
20
|
+
with:
|
21
|
+
path: vendor/bundle
|
22
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
23
|
+
restore-keys: |
|
24
|
+
${{ runner.os }}-gems-
|
25
|
+
- name: Install gems
|
26
|
+
run: |
|
27
|
+
bundle install --jobs 4 --retry 3
|
28
|
+
|
29
|
+
- name: Run tests
|
30
|
+
env:
|
31
|
+
RACK_ENV: test
|
32
|
+
run: bundle exec rspec
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.1
|
data/README.md
CHANGED
@@ -4,7 +4,64 @@
|
|
4
4
|
|
5
5
|
# AthenaHealth
|
6
6
|
|
7
|
-
Ruby wrapper for [Athenahealth API](
|
7
|
+
Ruby wrapper for [Athenahealth API](https://developer.api.athena.io/).
|
8
|
+
|
9
|
+
## Updating from gem version 1 (Mashery API) to gem version 2 (https://developer.api.athena.io/ API)
|
10
|
+
|
11
|
+
There is only one change needed to upgrade, and that is how you create a new client.
|
12
|
+
|
13
|
+
The new signature has 3 keywords:
|
14
|
+
```AthenaHealth::Client.new(production:, client_id: secret:)```
|
15
|
+
* `production:`
|
16
|
+
* `boolean`
|
17
|
+
* default `false`
|
18
|
+
* this replaces the `version:` keyword
|
19
|
+
* indicates if you want to access the preview enviroment or the production enviroment.
|
20
|
+
* `client_id:`
|
21
|
+
* `string`
|
22
|
+
* no default
|
23
|
+
* this replaces the `key:` keyword
|
24
|
+
* this should be your **Client ID** from the developer portal
|
25
|
+
* `secret:`
|
26
|
+
* `string`
|
27
|
+
* no default
|
28
|
+
* this should be your **Secret** from the developer portal
|
29
|
+
|
30
|
+
### Example
|
31
|
+
#### Gem v1 code
|
32
|
+
Preview:
|
33
|
+
```
|
34
|
+
client = AthenaHealth::Client.new(
|
35
|
+
version: 'preview1',
|
36
|
+
key: "my_client_id",
|
37
|
+
secret: "my_secret"
|
38
|
+
)
|
39
|
+
```
|
40
|
+
Production:
|
41
|
+
```
|
42
|
+
client = AthenaHealth::Client.new(
|
43
|
+
version: 'v1',
|
44
|
+
key: "my_client_id",
|
45
|
+
secret: "my_secret"
|
46
|
+
)
|
47
|
+
```
|
48
|
+
#### Gem v2 code
|
49
|
+
Preview:
|
50
|
+
```
|
51
|
+
client = AthenaHealth::Client.new(
|
52
|
+
production: false,
|
53
|
+
client_id: "my_client_id",
|
54
|
+
secret: "my_secret"
|
55
|
+
)
|
56
|
+
```
|
57
|
+
Production:
|
58
|
+
```
|
59
|
+
client = AthenaHealth::Client.new(
|
60
|
+
production: true,
|
61
|
+
client_id: "my_client_id",
|
62
|
+
secret: "my_secret"
|
63
|
+
)
|
64
|
+
```
|
8
65
|
|
9
66
|
## Examples
|
10
67
|
|
@@ -18,7 +75,7 @@ For some examples of how to use this library, check out [the project wiki](https
|
|
18
75
|
- Ensure you have Ruby and the Bundler gem installed
|
19
76
|
- Install the gem dependencies with `bundle`
|
20
77
|
- Setup Environment Variables before testing new endpoints, you'll need the following:
|
21
|
-
-
|
78
|
+
- ATHENA_TEST_CLIENT_ID
|
22
79
|
- ATHENA_TEST_SECRET
|
23
80
|
- ATHENA_TEST_ACCESS_TOKEN
|
24
81
|
|
data/athena_health.gemspec
CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_dependency 'typhoeus'
|
22
22
|
spec.add_dependency 'virtus'
|
23
23
|
|
24
|
-
spec.add_development_dependency 'bundler', '~>
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.2.24'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
27
27
|
spec.add_development_dependency 'vcr', '~> 3.0'
|
data/lib/athena_health.rb
CHANGED
@@ -12,9 +12,14 @@ 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'
|
16
|
+
require 'athena_health/endpoints/claims'
|
17
|
+
require 'athena_health/endpoints/custom_fields'
|
15
18
|
require 'athena_health/client'
|
16
19
|
require 'athena_health/base_collection'
|
17
20
|
require 'athena_health/base_model'
|
21
|
+
require 'athena_health/custom_field'
|
22
|
+
require 'athena_health/custom_field_data'
|
18
23
|
require 'athena_health/practice'
|
19
24
|
require 'athena_health/practice_collection'
|
20
25
|
require 'athena_health/department'
|
@@ -73,6 +78,9 @@ require 'athena_health/user_medication_event'
|
|
73
78
|
require 'athena_health/user_medication_sig'
|
74
79
|
require 'athena_health/user_medication'
|
75
80
|
require 'athena_health/user_medication_collection'
|
81
|
+
require 'athena_health/subscription'
|
82
|
+
require 'athena_health/claim/claim'
|
83
|
+
require 'athena_health/claim/claim_collection'
|
76
84
|
|
77
85
|
module AthenaHealth
|
78
86
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'athena_health/claim/diagnosis'
|
4
|
+
require 'athena_health/claim/payer'
|
5
|
+
require 'athena_health/claim/procedure'
|
6
|
+
module AthenaHealth
|
7
|
+
module Claim
|
8
|
+
class Claim < BaseModel
|
9
|
+
attribute :diagnoses, Array[Diagnosis]
|
10
|
+
attribute :primaryinsurancepayer, Payer
|
11
|
+
attribute :patientpayer, Payer
|
12
|
+
attribute :claimcreatedate, String
|
13
|
+
attribute :billedproviderid, Integer
|
14
|
+
attribute :billedservicedate, String
|
15
|
+
attribute :appointmentid, Integer
|
16
|
+
attribute :patientid, Integer
|
17
|
+
attribute :departmentid, Integer
|
18
|
+
attribute :customfields, Array[CustomFieldData]
|
19
|
+
attribute :reserved19, String
|
20
|
+
attribute :referringproviderid, Integer
|
21
|
+
attribute :procedures, Array[Procedure]
|
22
|
+
attribute :referralauthid, Integer
|
23
|
+
attribute :secondaryinsurancepayer, Payer
|
24
|
+
attribute :chargeamount, String
|
25
|
+
attribute :transactiondetails, Hash
|
26
|
+
attribute :claimid, Integer
|
27
|
+
attribute :transactionid, Integer
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
module Claim
|
5
|
+
class Diagnosis < BaseModel
|
6
|
+
attribute :diagnosisid, Integer
|
7
|
+
attribute :diagnosiscategory, String
|
8
|
+
attribute :diagnosisrawcode, String
|
9
|
+
attribute :diagnosiscodeset, String
|
10
|
+
attribute :diagnosisdescription, String
|
11
|
+
attribute :deleteddiagnosis, Boolean
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
module Claim
|
5
|
+
class Payer < BaseModel
|
6
|
+
attribute :patientinsuranceid, Integer
|
7
|
+
attribute :status, String
|
8
|
+
attribute :chargeamount, String
|
9
|
+
attribute :note, String
|
10
|
+
|
11
|
+
def initialize(args)
|
12
|
+
self.patientinsuranceid = args['primarypatientinsuranceid'] || args['secondarypatientinsuranceid']
|
13
|
+
super(args)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
module Claim
|
5
|
+
class Procedure < BaseModel
|
6
|
+
attribute :transactionid, Integer
|
7
|
+
attribute :allowableamount, String
|
8
|
+
attribute :procedurecategory, String
|
9
|
+
attribute :allowablemin, String
|
10
|
+
attribute :proceduredescription, String
|
11
|
+
attribute :chargeamount, String
|
12
|
+
attribute :procedurecode, String
|
13
|
+
attribute :allowablemax, String
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/athena_health/client.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module AthenaHealth
|
2
2
|
class Client
|
3
|
-
def initialize(
|
3
|
+
def initialize(production: false, client_id:, secret:, token: nil)
|
4
4
|
@api = AthenaHealth::Connection.new(
|
5
|
-
|
6
|
-
|
5
|
+
production: production,
|
6
|
+
client_id: client_id,
|
7
7
|
secret: secret,
|
8
8
|
token: token,
|
9
9
|
)
|
@@ -17,5 +17,8 @@ module AthenaHealth
|
|
17
17
|
include Endpoints::InsurancePackages
|
18
18
|
include Endpoints::Encounters
|
19
19
|
include Endpoints::Configurations
|
20
|
+
include Endpoints::Subscriptions
|
21
|
+
include Endpoints::Claims
|
22
|
+
include Endpoints::CustomFields
|
20
23
|
end
|
21
24
|
end
|
@@ -2,22 +2,25 @@ require 'json'
|
|
2
2
|
|
3
3
|
module AthenaHealth
|
4
4
|
class Connection
|
5
|
-
|
6
|
-
|
5
|
+
PRODUCTION_BASE_URL = 'https://api.platform.athenahealth.com'.freeze
|
6
|
+
PREVIEW_BASE_URL = 'https://api.preview.platform.athenahealth.com'.freeze
|
7
|
+
API_VERSION = 'v1'.freeze
|
7
8
|
|
8
|
-
def initialize(
|
9
|
-
@
|
10
|
-
@key = key
|
9
|
+
def initialize(client_id:, secret:, token: nil, production: )
|
10
|
+
@client_id = client_id
|
11
11
|
@secret = secret
|
12
12
|
@token = token
|
13
|
-
@
|
13
|
+
@production = production
|
14
14
|
end
|
15
15
|
|
16
16
|
def authenticate
|
17
17
|
response = Typhoeus.post(
|
18
|
-
"#{
|
19
|
-
userpwd: "#{@
|
20
|
-
body: {
|
18
|
+
"#{base_url}/oauth2/#{API_VERSION}/token",
|
19
|
+
userpwd: "#{@client_id}:#{@secret}",
|
20
|
+
body: {
|
21
|
+
grant_type: 'client_credentials',
|
22
|
+
scope: 'athena/service/Athenanet.MDP.*'
|
23
|
+
}
|
21
24
|
).response_body
|
22
25
|
|
23
26
|
@token = JSON.parse(response)['access_token']
|
@@ -27,7 +30,7 @@ module AthenaHealth
|
|
27
30
|
authenticate if @token.nil?
|
28
31
|
|
29
32
|
response = Typhoeus::Request.new(
|
30
|
-
"#{
|
33
|
+
"#{base_url}/#{API_VERSION}/#{endpoint}",
|
31
34
|
method: method,
|
32
35
|
headers: { "Authorization" => "Bearer #{@token}"},
|
33
36
|
params: params,
|
@@ -61,5 +64,9 @@ module AthenaHealth
|
|
61
64
|
def json_response(body)
|
62
65
|
JSON.parse(body)
|
63
66
|
end
|
67
|
+
|
68
|
+
def base_url
|
69
|
+
@base_url ||= @production ? PRODUCTION_BASE_URL : PREVIEW_BASE_URL
|
70
|
+
end
|
64
71
|
end
|
65
72
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
class CustomField < BaseModel
|
5
|
+
attribute :ordering, String
|
6
|
+
attribute :name, String
|
7
|
+
attribute :length, String
|
8
|
+
attribute :type, String
|
9
|
+
attribute :disallowupdateyn, Boolean
|
10
|
+
attribute :casesensitiveyn, Boolean
|
11
|
+
attribute :searchableyn, Boolean
|
12
|
+
attribute :selectyn, Boolean
|
13
|
+
|
14
|
+
attribute :customfieldid, Integer
|
15
|
+
attribute :selectlist, Array[Hash]
|
16
|
+
end
|
17
|
+
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,
|
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,
|
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,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
module Endpoints
|
5
|
+
module Claims
|
6
|
+
def find_claim(practice_id:, claim_id:, params: {})
|
7
|
+
response = @api.call(
|
8
|
+
endpoint: "#{practice_id}/claims/#{claim_id}",
|
9
|
+
method: :get,
|
10
|
+
params: params
|
11
|
+
)
|
12
|
+
|
13
|
+
Claim::Claim.new(response)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AthenaHealth
|
4
|
+
module Endpoints
|
5
|
+
module CustomFields
|
6
|
+
def all_custom_fields(practice_id:, params: {})
|
7
|
+
response = @api.call(
|
8
|
+
endpoint: "#{practice_id}/customfields",
|
9
|
+
method: :get,
|
10
|
+
params: params
|
11
|
+
)
|
12
|
+
response.map { |field| CustomField.new(field) }
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -45,6 +45,22 @@ module AthenaHealth
|
|
45
45
|
body: body
|
46
46
|
)
|
47
47
|
end
|
48
|
+
|
49
|
+
def create_order_group(practice_id:, patient_id:, body: {})
|
50
|
+
@api.call(
|
51
|
+
endpoint: "#{practice_id}/chart/#{patient_id}/ordergroups",
|
52
|
+
method: :post,
|
53
|
+
body: body
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_encounter_diagnoses(practice_id:, encounter_id:, body: {})
|
58
|
+
@api.call(
|
59
|
+
endpoint: "#{practice_id}/chart/encounter/#{encounter_id}/diagnoses",
|
60
|
+
method: :post,
|
61
|
+
body: body
|
62
|
+
)
|
63
|
+
end
|
48
64
|
end
|
49
65
|
end
|
50
66
|
end
|
@@ -374,6 +374,14 @@ module AthenaHealth
|
|
374
374
|
body: params.merge!(image: image)
|
375
375
|
)
|
376
376
|
end
|
377
|
+
|
378
|
+
def create_patient_case(practice_id:, patient_id:, params: {})
|
379
|
+
@api.call(
|
380
|
+
endpoint: "#{practice_id}/patients/#{patient_id}/documents/patientcase",
|
381
|
+
method: :post,
|
382
|
+
body: params
|
383
|
+
)
|
384
|
+
end
|
377
385
|
end
|
378
386
|
end
|
379
387
|
end
|
@@ -0,0 +1,94 @@
|
|
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
|
+
{
|
56
|
+
collection_class: 'Claim::ClaimCollection',
|
57
|
+
path: 'claims',
|
58
|
+
name: 'claim',
|
59
|
+
plural_name: 'claims'
|
60
|
+
}
|
61
|
+
].freeze
|
62
|
+
|
63
|
+
SUBSCRIPTION_TYPES.each do |subscription_type|
|
64
|
+
define_method("#{subscription_type[:name]}_subscription") do |practice_id:, params: {}|
|
65
|
+
response = @api.call(
|
66
|
+
endpoint: "#{practice_id}/#{subscription_type[:path]}/changed/subscription",
|
67
|
+
method: :get,
|
68
|
+
params: params
|
69
|
+
)
|
70
|
+
|
71
|
+
Subscription.new(response)
|
72
|
+
end
|
73
|
+
|
74
|
+
define_method("create_#{subscription_type[:name]}_subscription") do |practice_id:, params: {}|
|
75
|
+
@api.call(
|
76
|
+
endpoint: "#{practice_id}/#{subscription_type[:path]}/changed/subscription",
|
77
|
+
method: :post,
|
78
|
+
params: params
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
define_method("changed_#{subscription_type[:plural_name]}") do |practice_id:, department_id: nil, params: {}|
|
83
|
+
params[:departmentid] = department_id unless department_id.nil?
|
84
|
+
response = @api.call(
|
85
|
+
endpoint: "#{practice_id}/#{subscription_type[:path]}/changed",
|
86
|
+
method: :get,
|
87
|
+
params: params
|
88
|
+
)
|
89
|
+
Object.const_get('AthenaHealth').const_get((subscription_type[:collection_class]).to_s).new(response)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
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
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mateusz Urbański
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.2.24
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.2.24
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -102,8 +102,10 @@ executables: []
|
|
102
102
|
extensions: []
|
103
103
|
extra_rdoc_files: []
|
104
104
|
files:
|
105
|
+
- ".github/workflows/ci.yml"
|
105
106
|
- ".gitignore"
|
106
107
|
- ".rspec"
|
108
|
+
- ".ruby-version"
|
107
109
|
- ".travis.yml"
|
108
110
|
- Gemfile
|
109
111
|
- LICENSE.txt
|
@@ -124,8 +126,15 @@ files:
|
|
124
126
|
- lib/athena_health/balance.rb
|
125
127
|
- lib/athena_health/base_collection.rb
|
126
128
|
- lib/athena_health/base_model.rb
|
129
|
+
- lib/athena_health/claim/claim.rb
|
130
|
+
- lib/athena_health/claim/claim_collection.rb
|
131
|
+
- lib/athena_health/claim/diagnosis.rb
|
132
|
+
- lib/athena_health/claim/payer.rb
|
133
|
+
- lib/athena_health/claim/procedure.rb
|
127
134
|
- lib/athena_health/client.rb
|
128
135
|
- lib/athena_health/connection.rb
|
136
|
+
- lib/athena_health/custom_field.rb
|
137
|
+
- lib/athena_health/custom_field_data.rb
|
129
138
|
- lib/athena_health/department.rb
|
130
139
|
- lib/athena_health/department_collection.rb
|
131
140
|
- lib/athena_health/document.rb
|
@@ -134,13 +143,16 @@ files:
|
|
134
143
|
- lib/athena_health/encounter_collection.rb
|
135
144
|
- lib/athena_health/encounter_summary.rb
|
136
145
|
- lib/athena_health/endpoints/appointments.rb
|
146
|
+
- lib/athena_health/endpoints/claims.rb
|
137
147
|
- lib/athena_health/endpoints/configurations.rb
|
148
|
+
- lib/athena_health/endpoints/custom_fields.rb
|
138
149
|
- lib/athena_health/endpoints/departments.rb
|
139
150
|
- lib/athena_health/endpoints/encounters.rb
|
140
151
|
- lib/athena_health/endpoints/insurance_packages.rb
|
141
152
|
- lib/athena_health/endpoints/patients.rb
|
142
153
|
- lib/athena_health/endpoints/practices.rb
|
143
154
|
- lib/athena_health/endpoints/providers.rb
|
155
|
+
- lib/athena_health/endpoints/subscriptions.rb
|
144
156
|
- lib/athena_health/error.rb
|
145
157
|
- lib/athena_health/event.rb
|
146
158
|
- lib/athena_health/facility.rb
|
@@ -175,6 +187,7 @@ files:
|
|
175
187
|
- lib/athena_health/question_collection.rb
|
176
188
|
- lib/athena_health/reaction.rb
|
177
189
|
- lib/athena_health/social_history.rb
|
190
|
+
- lib/athena_health/subscription.rb
|
178
191
|
- lib/athena_health/template.rb
|
179
192
|
- lib/athena_health/user_allergy.rb
|
180
193
|
- lib/athena_health/user_allergy_collection.rb
|
@@ -187,7 +200,7 @@ homepage: https://github.com/zywy/athena_health
|
|
187
200
|
licenses:
|
188
201
|
- MIT
|
189
202
|
metadata: {}
|
190
|
-
post_install_message:
|
203
|
+
post_install_message:
|
191
204
|
rdoc_options: []
|
192
205
|
require_paths:
|
193
206
|
- lib
|
@@ -202,8 +215,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
215
|
- !ruby/object:Gem::Version
|
203
216
|
version: '0'
|
204
217
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
206
|
-
signing_key:
|
218
|
+
rubygems_version: 3.2.15
|
219
|
+
signing_key:
|
207
220
|
specification_version: 4
|
208
221
|
summary: Ruby wrapper for Athenahealth API.
|
209
222
|
test_files: []
|