bonnie_bundler 2.1.0 → 2.1.1

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: 61b0e2dce988134311e1747adf13ea68859a5799
4
- data.tar.gz: 7e8638a383ead0635f662fa55da51baedf4ae0cd
3
+ metadata.gz: 59f7169b44522c0bdf701f08fdf1af88d5f3b970
4
+ data.tar.gz: 9ee6c19104b0e607fc19945f61d404140b94ad9b
5
5
  SHA512:
6
- metadata.gz: ac0422c09d3a74be3c68bccd8cc595ca02f44d64c5bc9b3ab64f46c88dbc96c9d5b4f1e360c4c4b04d6f108fe3f30f8749757581a9aec7d376779aab08a7cc85
7
- data.tar.gz: d1ffdbdd9a4bf57ee3def0d184960164c77074c18a65cbee955e464cc0d7fa76ab73929c328ee04b4446e3ae0ff21f9062b2241dcce3689cceb0d91f23bedf58
6
+ metadata.gz: 213d2fa47d4cc70594eef2ad4378a4231e765a14543cde486da9e7ec6e203e55d02fb2c91bb7c1cbdb3a2f4d5a5e44ef0c12bb15064862eaa61a5991feae1379
7
+ data.tar.gz: 9e6d63d149031247969ec89c8f2ba38aba5baadf75e5e7c97f83f65e65889a101a7c7d766e3860041bf5128446471690f12a2cb8720ff9ff156c498b446486c1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bonnie_bundler (2.1.0)
4
+ bonnie_bundler (2.1.1)
5
5
  diffy (~> 3.0.0)
6
6
  health-data-standards (~> 4.0)
7
7
  hqmf2js (~> 1.4)
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.email = "pophealth-talk@googlegroups.com"
8
8
  s.homepage = "http://github.com/projecttacoma/bonnie_bundler"
9
9
  s.authors = ["The MITRE Corporation"]
10
- s.version = '2.1.0'
10
+ s.version = '2.1.1'
11
11
  s.license = 'Apache-2.0'
12
12
 
13
13
  s.add_dependency 'health-data-standards', '~> 4.0'
data/lib/util/vsac_api.rb CHANGED
@@ -171,6 +171,43 @@ module Util
171
171
  end
172
172
  end
173
173
 
174
+ ##
175
+ # Gets the latest profile for a program. This is a separate call from the program details call. It returns JSON
176
+ # with only the name of the latest profile and the timestamp of the request. ex:
177
+ # {
178
+ # "name": "eCQM Update 2018-05-04",
179
+ # "requestTime": "2018-05-21 03:39:04 PM"
180
+ # }
181
+ #
182
+ # Optional parameter program is the program to request from the API. If it is not provided it will look for
183
+ # a :program in the config passed in during construction. If there is no :program in the config it will use
184
+ # the DEFAULT_PROGRAM constant for the program.
185
+ #
186
+ # Returns the name of the latest profile for the given program.
187
+ def get_latest_profile_for_program(program = nil)
188
+ # if no program was provided use the one in the config or default in constant
189
+ if program.nil?
190
+ program = @config.fetch(:program, DEFAULT_PROGRAM)
191
+ end
192
+
193
+ begin
194
+ # parse json response and return it
195
+ parsedResponse = JSON.parse(RestClient.get("#{@config[:utility_url]}/program/#{ERB::Util.url_encode(program)}/latest%20profile"))
196
+
197
+ # As of 5/17/18 VSAC does not return 404 when an invalid profile is provided. It just doesnt fill the name
198
+ # attribute in the 200 response. We need to check this.
199
+ if !parsedResponse['name'].nil?
200
+ return parsedResponse['name']
201
+ else
202
+ raise VSACProgramNotFoundError.new(program)
203
+ end
204
+
205
+ # keeping this rescue block in case the API is changed to return 404 for invalid profile
206
+ rescue RestClient::ResourceNotFound
207
+ raise VSACProgramNotFoundError.new(program)
208
+ end
209
+ end
210
+
174
211
  ##
175
212
  # Gets the releases for a program. This may be used without credentials.
176
213
  #
@@ -0,0 +1,54 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://vsac.nlm.nih.gov/vsac/program/CMS%20eCQM/latest%20profile
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ''
20
+ headers:
21
+ Cache-Control:
22
+ - no-cache, no-store, max-age=0, must-revalidate
23
+ Pragma:
24
+ - no-cache
25
+ Expires:
26
+ - '0'
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json
35
+ Content-Length:
36
+ - '72'
37
+ Date:
38
+ - Thu, 17 May 2018 13:39:30 GMT
39
+ Set-Cookie:
40
+ - BIGipServervsacweb_p=!gjgpljECCT0SWr7NtNHn4GsLooFbUxOwIRTnyLmMPPLqsyPnSfkFr/NITt4Yh4Jaw1OR1Rih8Ghnp6c=;
41
+ expires=Thu, 17-May-2018 15:39:30 GMT; path=/; Httponly; Secure
42
+ X-Vip-Info:
43
+ - 130.14.16.40:443
44
+ X-Pool-Info:
45
+ - "/Common/vsacweb_p 10.1.5.114 8080"
46
+ Strict-Transport-Security:
47
+ - max-age=31536000; includeSubDomains; preload
48
+ body:
49
+ encoding: UTF-8
50
+ string: '{"name":"eCQM Update 2018-05-04","requestTime":"2018-05-17 09:39:30
51
+ AM"}'
52
+ http_version:
53
+ recorded_at: Thu, 17 May 2018 13:39:30 GMT
54
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,53 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://vsac.nlm.nih.gov/vsac/program/Fake%20Program/latest%20profile
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: ''
20
+ headers:
21
+ Cache-Control:
22
+ - no-cache, no-store, max-age=0, must-revalidate
23
+ Pragma:
24
+ - no-cache
25
+ Expires:
26
+ - '0'
27
+ X-Xss-Protection:
28
+ - 1; mode=block
29
+ X-Frame-Options:
30
+ - SAMEORIGIN
31
+ X-Content-Type-Options:
32
+ - nosniff
33
+ Content-Type:
34
+ - application/json
35
+ Content-Length:
36
+ - '40'
37
+ Date:
38
+ - Thu, 17 May 2018 13:39:30 GMT
39
+ Set-Cookie:
40
+ - BIGipServervsacweb_p=!CLsEMgdFnW3bRfDm9OGvBt4MxRMcjrEVY8cdRpHtXPSP+3AnVzmCsTSM6YIPSG2dw+05YFSqHcRtXkk=;
41
+ expires=Thu, 17-May-2018 15:39:30 GMT; path=/; Httponly; Secure
42
+ X-Vip-Info:
43
+ - 130.14.16.40:443
44
+ X-Pool-Info:
45
+ - "/Common/vsacweb_p 10.1.5.114 8080"
46
+ Strict-Transport-Security:
47
+ - max-age=31536000; includeSubDomains; preload
48
+ body:
49
+ encoding: UTF-8
50
+ string: '{"requestTime":"2018-05-17 09:39:30 AM"}'
51
+ http_version:
52
+ recorded_at: Thu, 17 May 2018 13:39:30 GMT
53
+ recorded_with: VCR 3.0.3
@@ -136,4 +136,26 @@ class VSACAPIUtilTest < ActiveSupport::TestCase
136
136
  end
137
137
  end
138
138
  end
139
+
140
+ test 'get_latest_profile_for_program for valid program' do
141
+ VCR.use_cassette("vsac_util_get_latest_profile_for_program_CMS_eCQM") do
142
+ latest_profile = @api.get_latest_profile_for_program('CMS eCQM')
143
+ assert_equal "eCQM Update 2018-05-04", latest_profile
144
+ end
145
+ end
146
+
147
+ test 'get_latest_profile_for_program for default program' do
148
+ VCR.use_cassette("vsac_util_get_latest_profile_for_program_CMS_eCQM") do
149
+ latest_profile = @api.get_latest_profile_for_program
150
+ assert_equal "eCQM Update 2018-05-04", latest_profile
151
+ end
152
+ end
153
+
154
+ test 'get_latest_profile_for_program for invalid program' do
155
+ VCR.use_cassette("vsac_util_get_latest_profile_for_program_invalid") do
156
+ assert_raise Util::VSAC::VSACProgramNotFoundError do
157
+ @api.get_latest_profile_for_program('Fake Program')
158
+ end
159
+ end
160
+ end
139
161
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bonnie_bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MITRE Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-03 00:00:00.000000000 Z
11
+ date: 2018-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: health-data-standards
@@ -234,6 +234,8 @@ files:
234
234
  - test/fixtures/vcr_cassettes/vsac_auth_bad_ticket.yml
235
235
  - test/fixtures/vcr_cassettes/vsac_auth_good_credentials.yml
236
236
  - test/fixtures/vcr_cassettes/vsac_auth_good_credentials_and_simple_call.yml
237
+ - test/fixtures/vcr_cassettes/vsac_util_get_latest_profile_for_program_CMS_eCQM.yml
238
+ - test/fixtures/vcr_cassettes/vsac_util_get_latest_profile_for_program_invalid.yml
237
239
  - test/fixtures/vcr_cassettes/vsac_util_get_profiles.yml
238
240
  - test/fixtures/vcr_cassettes/vsac_util_get_program_details_CMS_Hybrid.yml
239
241
  - test/fixtures/vcr_cassettes/vsac_util_get_program_details_CMS_eCQM.yml
@@ -282,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
282
284
  version: '0'
283
285
  requirements: []
284
286
  rubyforge_project:
285
- rubygems_version: 2.6.12
287
+ rubygems_version: 2.6.14
286
288
  signing_key:
287
289
  specification_version: 4
288
290
  summary: A Gem for creating and managing bonnie bundles