athena_health 1.0.51 → 2.0.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
  SHA256:
3
- metadata.gz: 07d8184d8d4496efed5f56797d1bccf9a2bf4495ffc847f93615c754d03227cf
4
- data.tar.gz: f66da575c19fdea4691e0ef8509eed1d50cdcd048deb4a293530c16fb4149fd9
3
+ metadata.gz: 770807e4bf3b5d93401d26193dbb62d5a08bc1aa920c09f2912759ae1a664800
4
+ data.tar.gz: 118ffe8282b8e6d7883a748deda6fa2ce11c5b5cbb963b75bf75e6d76d1a220e
5
5
  SHA512:
6
- metadata.gz: 0b2244cf5dd99f900160a5487ed2361051d40a4797e41ec64518356475d4f3120410408a26ce057a01d4d8f9a3c98fd7e9cf3a37f92ef126497d11d026f797a1
7
- data.tar.gz: 026bfaa5ef3a32054e0cb98304d7207c1c0514890fbb29f80cdf9f565cb3917cf752e9a5a550cbcd25c6625450d63f89356fc439de69d99a5233f9f2b14755c7
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](http://www.athenahealth.com/developer-portal).
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
- - ATHENA_TEST_KEY
78
+ - ATHENA_TEST_CLIENT_ID
22
79
  - ATHENA_TEST_SECRET
23
80
  - ATHENA_TEST_ACCESS_TOKEN
24
81
 
@@ -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', '~> 1.11'
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'
@@ -1,9 +1,9 @@
1
1
  module AthenaHealth
2
2
  class Client
3
- def initialize(version:, key:, secret:, token: nil)
3
+ def initialize(production: false, client_id:, secret:, token: nil)
4
4
  @api = AthenaHealth::Connection.new(
5
- version: version,
6
- key: key,
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
- BASE_URL = 'https://api.athenahealth.com'.freeze
6
- AUTH_PATH = { 'v1' => 'oauth', 'preview1' => 'oauthpreview', 'openpreview1' => 'oauthopenpreview' }
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(version:, key:, secret:, token: nil, base_url: BASE_URL)
9
- @version = version
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
- @base_url = base_url
13
+ @production = production
14
14
  end
15
15
 
16
16
  def authenticate
17
17
  response = Typhoeus.post(
18
- "#{@base_url}/#{AUTH_PATH[@version]}/token",
19
- userpwd: "#{@key}:#{@secret}",
20
- body: { grant_type: 'client_credentials' }
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
- "#{@base_url}/#{@version}/#{endpoint}",
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
@@ -1,3 +1,3 @@
1
1
  module AthenaHealth
2
- VERSION = '1.0.51'.freeze
2
+ VERSION = '2.0.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: 1.0.51
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: 2020-03-17 00:00:00.000000000 Z
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: '1.11'
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: '1.11'
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.0.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: []