athena_health 1.0.51 → 2.0.1
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 +33 -0
- data/.ruby-version +1 -0
- data/README.md +60 -4
- data/athena_health.gemspec +1 -1
- data/lib/athena_health/client.rb +3 -3
- data/lib/athena_health/connection.rb +17 -10
- data/lib/athena_health/patient.rb +3 -0
- data/lib/athena_health/version.rb +1 -1
- metadata +10 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14f98cfaa15caca65ad1fbc036674eb76d38fd0a5bee50a4b20c64149d286cce
|
4
|
+
data.tar.gz: ad2e1d5be5847a5f5bed1e4df4b583ab474ea15b2d60b807e9b671e5f698f5d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 616b05bc653fd2722229718b9ba633cd19263d1dfadbaa0c15abbddc70c61703749343d5af14027f1fa583498491f4c490ac42d5e855e624e6cbce68f7facac5
|
7
|
+
data.tar.gz: 709e309ceaf94ccd4a0c0b716d8bdb350d4d97f66f1079c416320ba0dfaf769979a8a66c25e30084c19b8df871ee532e233685de52547412f045aae57bfc1d9f
|
@@ -0,0 +1,33 @@
|
|
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
|
+
bundler: 2.2.24
|
18
|
+
|
19
|
+
- name: Ruby gem cache
|
20
|
+
uses: actions/cache@v2
|
21
|
+
with:
|
22
|
+
path: vendor/bundle
|
23
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
24
|
+
restore-keys: |
|
25
|
+
${{ runner.os }}-gems-
|
26
|
+
- name: Install gems
|
27
|
+
run: |
|
28
|
+
bundle install --jobs 4 --retry 3
|
29
|
+
|
30
|
+
- name: Run tests
|
31
|
+
env:
|
32
|
+
RACK_ENV: test
|
33
|
+
run: bundle exec rspec
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.0.1
|
data/README.md
CHANGED
@@ -1,10 +1,66 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/athena_health.svg)](https://badge.fury.io/rb/athena_health)
|
2
|
-
[![
|
3
|
-
[![Dependency Status](https://gemnasium.com/zywy/athena_health.svg)](https://gemnasium.com/zywy/athena_health)
|
2
|
+
[![Continuous integration](https://github.com/HealthTechDevelopers/athena_health/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/HealthTechDevelopers/athena_health/actions/workflows/ci.yml)
|
4
3
|
|
5
4
|
# AthenaHealth
|
6
5
|
|
7
|
-
Ruby wrapper for [Athenahealth API](
|
6
|
+
Ruby wrapper for [Athenahealth API](https://developer.api.athena.io/).
|
7
|
+
|
8
|
+
## Updating from gem version 1 (Mashery API) to gem version 2 (https://developer.api.athena.io/ API)
|
9
|
+
|
10
|
+
There is only one change needed to upgrade, and that is how you create a new client.
|
11
|
+
|
12
|
+
The new signature has 3 keywords:
|
13
|
+
```AthenaHealth::Client.new(production:, client_id: secret:)```
|
14
|
+
* `production:`
|
15
|
+
* `boolean`
|
16
|
+
* default `false`
|
17
|
+
* this replaces the `version:` keyword
|
18
|
+
* indicates if you want to access the preview enviroment or the production enviroment.
|
19
|
+
* `client_id:`
|
20
|
+
* `string`
|
21
|
+
* no default
|
22
|
+
* this replaces the `key:` keyword
|
23
|
+
* this should be your **Client ID** from the developer portal
|
24
|
+
* `secret:`
|
25
|
+
* `string`
|
26
|
+
* no default
|
27
|
+
* this should be your **Secret** from the developer portal
|
28
|
+
|
29
|
+
### Example
|
30
|
+
#### Gem v1 code
|
31
|
+
Preview:
|
32
|
+
```
|
33
|
+
client = AthenaHealth::Client.new(
|
34
|
+
version: 'preview1',
|
35
|
+
key: "my_client_id",
|
36
|
+
secret: "my_secret"
|
37
|
+
)
|
38
|
+
```
|
39
|
+
Production:
|
40
|
+
```
|
41
|
+
client = AthenaHealth::Client.new(
|
42
|
+
version: 'v1',
|
43
|
+
key: "my_client_id",
|
44
|
+
secret: "my_secret"
|
45
|
+
)
|
46
|
+
```
|
47
|
+
#### Gem v2 code
|
48
|
+
Preview:
|
49
|
+
```
|
50
|
+
client = AthenaHealth::Client.new(
|
51
|
+
production: false,
|
52
|
+
client_id: "my_client_id",
|
53
|
+
secret: "my_secret"
|
54
|
+
)
|
55
|
+
```
|
56
|
+
Production:
|
57
|
+
```
|
58
|
+
client = AthenaHealth::Client.new(
|
59
|
+
production: true,
|
60
|
+
client_id: "my_client_id",
|
61
|
+
secret: "my_secret"
|
62
|
+
)
|
63
|
+
```
|
8
64
|
|
9
65
|
## Examples
|
10
66
|
|
@@ -18,7 +74,7 @@ For some examples of how to use this library, check out [the project wiki](https
|
|
18
74
|
- Ensure you have Ruby and the Bundler gem installed
|
19
75
|
- Install the gem dependencies with `bundle`
|
20
76
|
- Setup Environment Variables before testing new endpoints, you'll need the following:
|
21
|
-
-
|
77
|
+
- ATHENA_TEST_CLIENT_ID
|
22
78
|
- ATHENA_TEST_SECRET
|
23
79
|
- ATHENA_TEST_ACCESS_TOKEN
|
24
80
|
|
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/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
|
)
|
@@ -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
|
@@ -98,6 +98,9 @@ module AthenaHealth
|
|
98
98
|
attribute :guarantoremployerid, Integer
|
99
99
|
attribute :employername, String
|
100
100
|
attribute :employeraddress, String
|
101
|
+
attribute :altfirstname, String
|
102
|
+
attribute :assignedsexatbirth, String
|
103
|
+
attribute :preferredpronouns, String
|
101
104
|
|
102
105
|
def fullname
|
103
106
|
"#{firstname} #{middlename} #{lastname}"
|
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.1
|
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: 2022-12-06 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
|
@@ -198,7 +200,7 @@ homepage: https://github.com/zywy/athena_health
|
|
198
200
|
licenses:
|
199
201
|
- MIT
|
200
202
|
metadata: {}
|
201
|
-
post_install_message:
|
203
|
+
post_install_message:
|
202
204
|
rdoc_options: []
|
203
205
|
require_paths:
|
204
206
|
- lib
|
@@ -213,8 +215,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
215
|
- !ruby/object:Gem::Version
|
214
216
|
version: '0'
|
215
217
|
requirements: []
|
216
|
-
rubygems_version: 3.
|
217
|
-
signing_key:
|
218
|
+
rubygems_version: 3.2.15
|
219
|
+
signing_key:
|
218
220
|
specification_version: 4
|
219
221
|
summary: Ruby wrapper for Athenahealth API.
|
220
222
|
test_files: []
|