cover_my_meds 2.1.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/cover_my_meds.gemspec +4 -3
- data/lib/cover_my_meds/api_request.rb +24 -25
- data/lib/cover_my_meds/client/indicators.rb +2 -2
- data/lib/cover_my_meds/version.rb +1 -1
- metadata +27 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab2c4a5403a14c4c6e3d376f164c9c12a967096a
|
4
|
+
data.tar.gz: 31afd606a40608f3f4ada82f631843604b31b395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4527b7f965c94cdcecf5b5108506b56de655807916395597a63dd6cfbee1504980743aaa857468d49cf7f6e9942e777cf47b56acaa897ef45bfd9de315e62de3
|
7
|
+
data.tar.gz: 4b2da155c780055ba5c86e40700c76e32126c5665c9da24c96d3d371dec9ca0a59a2fbc53a28faddc01dfda2cc45b3e102a31c0cd0e8eaa5a1fe609a0db6f261
|
data/.gitignore
CHANGED
data/cover_my_meds.gemspec
CHANGED
@@ -21,15 +21,16 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler"
|
22
22
|
spec.add_development_dependency "rspec", ">= 3.2"
|
23
23
|
spec.add_development_dependency "rspec-junklet", ">= 2.0"
|
24
|
-
spec.add_development_dependency "webmock", "~>
|
24
|
+
spec.add_development_dependency "webmock", "~> 2.0"
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "pry"
|
27
27
|
spec.add_development_dependency "dotenv"
|
28
28
|
spec.add_development_dependency "simplecov"
|
29
29
|
spec.add_development_dependency "railties"
|
30
30
|
|
31
|
-
spec.add_runtime_dependency "
|
31
|
+
spec.add_runtime_dependency "faraday", "~> 0.9"
|
32
|
+
spec.add_runtime_dependency "typhoeus"
|
33
|
+
spec.add_runtime_dependency "mime-types"
|
32
34
|
spec.add_runtime_dependency "hashie", ">= 3.4.0"
|
33
|
-
spec.add_runtime_dependency "settingslogic"
|
34
35
|
spec.add_runtime_dependency "activesupport"
|
35
36
|
end
|
@@ -1,30 +1,43 @@
|
|
1
|
-
require '
|
1
|
+
require 'faraday'
|
2
|
+
require 'typhoeus'
|
3
|
+
require 'typhoeus/adapters/faraday'
|
2
4
|
require 'json'
|
3
5
|
require 'hashie'
|
4
6
|
require 'active_support/core_ext/object/to_param'
|
5
7
|
require 'active_support/core_ext/object/to_query'
|
6
8
|
require 'cover_my_meds/error'
|
9
|
+
require 'mime-types'
|
10
|
+
|
7
11
|
|
8
12
|
module CoverMyMeds
|
9
13
|
module ApiRequest
|
14
|
+
DEFAULT_TIMEOUT = 60 #seconds, matches Net::Http's default which rest-client used
|
10
15
|
|
11
16
|
def request(http_method, host, path, params={}, auth_type = :basic, &block)
|
12
17
|
params = params.symbolize_keys
|
13
18
|
headers = params.delete(:headers) || {}
|
14
19
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
conn = Faraday.new host do |faraday|
|
21
|
+
faraday.request :multipart
|
22
|
+
faraday.request :url_encoded
|
23
|
+
faraday.adapter :typhoeus
|
24
|
+
end
|
25
|
+
case auth_type
|
26
|
+
when :basic
|
27
|
+
conn.basic_auth @username, @password
|
28
|
+
when :bearer
|
29
|
+
conn.authorization :Bearer, "#{@username}+#{params.delete(:token_id)}"
|
22
30
|
end
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
response = conn.send http_method do |request|
|
33
|
+
request.url path
|
34
|
+
request.options.timeout = DEFAULT_TIMEOUT
|
35
|
+
request.params = params
|
36
|
+
request.headers.merge! headers
|
37
|
+
request.body = block_given? ? yield : {}
|
38
|
+
end
|
39
|
+
raise Error::HTTPError.new(response.status, response.body, http_method, conn) unless response.success?
|
26
40
|
|
27
|
-
response = call_api http_method, rest_resource, &block
|
28
41
|
parse_response response
|
29
42
|
end
|
30
43
|
|
@@ -34,19 +47,5 @@ module CoverMyMeds
|
|
34
47
|
rescue JSON::ParserError
|
35
48
|
response.body
|
36
49
|
end
|
37
|
-
|
38
|
-
def call_api http_method, rest_resource
|
39
|
-
body = block_given? ? yield : {}
|
40
|
-
rest_resource.send http_method, body
|
41
|
-
rescue RestClient::Exception => e
|
42
|
-
raise Error::HTTPError.new(e.http_code, e.http_body, http_method, rest_resource)
|
43
|
-
end
|
44
|
-
|
45
|
-
def api_uri host, path, params
|
46
|
-
URI.parse(host).tap do |uri|
|
47
|
-
uri.path = path
|
48
|
-
uri.query = params.to_param
|
49
|
-
end
|
50
|
-
end
|
51
50
|
end
|
52
51
|
end
|
@@ -6,7 +6,7 @@ module CoverMyMeds
|
|
6
6
|
|
7
7
|
def post_indicators(prescription: prescription(), patient: patient(), payer: {}, prescriber: {}, version: CURRENT_VERSION)
|
8
8
|
params = { prescription: prescription, prescriber: prescriber, patient: patient, payer: payer }
|
9
|
-
data = indicators_request POST, params: { v: version, headers: { content_type:
|
9
|
+
data = indicators_request POST, params: { v: version, headers: { content_type: "application/json" } } do
|
10
10
|
params.to_json
|
11
11
|
end
|
12
12
|
Hashie::Mash.new(data)
|
@@ -14,7 +14,7 @@ module CoverMyMeds
|
|
14
14
|
|
15
15
|
def search_indicators(prescriptions: prescriptions(), patient: {}, payer: {}, prescriber: {}, version: CURRENT_VERSION)
|
16
16
|
params = { prescriptions: Array(prescriptions), prescriber: prescriber, patient: patient, payer: payer }
|
17
|
-
data = indicators_request POST, path: 'search/', params: { v: version, headers: { content_type:
|
17
|
+
data = indicators_request POST, path: 'search/', params: { v: version, headers: { content_type: "application/json" } } do
|
18
18
|
params.to_json
|
19
19
|
end
|
20
20
|
Hashie::Mash.new(data)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cover_my_meds
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Rolston
|
@@ -23,7 +23,7 @@ authors:
|
|
23
23
|
autorequire:
|
24
24
|
bindir: exe
|
25
25
|
cert_chain: []
|
26
|
-
date: 2016-10-
|
26
|
+
date: 2016-10-19 00:00:00.000000000 Z
|
27
27
|
dependencies:
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: bundler
|
@@ -73,14 +73,14 @@ dependencies:
|
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
76
|
+
version: '2.0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
83
|
+
version: '2.0'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: rake
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,35 +152,35 @@ dependencies:
|
|
152
152
|
- !ruby/object:Gem::Version
|
153
153
|
version: '0'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
|
-
name:
|
155
|
+
name: faraday
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - "~>"
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: '
|
160
|
+
version: '0.9'
|
161
161
|
type: :runtime
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - "~>"
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: '
|
167
|
+
version: '0.9'
|
168
168
|
- !ruby/object:Gem::Dependency
|
169
|
-
name:
|
169
|
+
name: typhoeus
|
170
170
|
requirement: !ruby/object:Gem::Requirement
|
171
171
|
requirements:
|
172
172
|
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
|
-
version:
|
174
|
+
version: '0'
|
175
175
|
type: :runtime
|
176
176
|
prerelease: false
|
177
177
|
version_requirements: !ruby/object:Gem::Requirement
|
178
178
|
requirements:
|
179
179
|
- - ">="
|
180
180
|
- !ruby/object:Gem::Version
|
181
|
-
version:
|
181
|
+
version: '0'
|
182
182
|
- !ruby/object:Gem::Dependency
|
183
|
-
name:
|
183
|
+
name: mime-types
|
184
184
|
requirement: !ruby/object:Gem::Requirement
|
185
185
|
requirements:
|
186
186
|
- - ">="
|
@@ -193,6 +193,20 @@ dependencies:
|
|
193
193
|
- - ">="
|
194
194
|
- !ruby/object:Gem::Version
|
195
195
|
version: '0'
|
196
|
+
- !ruby/object:Gem::Dependency
|
197
|
+
name: hashie
|
198
|
+
requirement: !ruby/object:Gem::Requirement
|
199
|
+
requirements:
|
200
|
+
- - ">="
|
201
|
+
- !ruby/object:Gem::Version
|
202
|
+
version: 3.4.0
|
203
|
+
type: :runtime
|
204
|
+
prerelease: false
|
205
|
+
version_requirements: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: 3.4.0
|
196
210
|
- !ruby/object:Gem::Dependency
|
197
211
|
name: activesupport
|
198
212
|
requirement: !ruby/object:Gem::Requirement
|
@@ -271,8 +285,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
271
285
|
version: '0'
|
272
286
|
requirements: []
|
273
287
|
rubyforge_project:
|
274
|
-
rubygems_version: 2.4.
|
288
|
+
rubygems_version: 2.4.6
|
275
289
|
signing_key:
|
276
290
|
specification_version: 4
|
277
291
|
summary: CoverMyMeds Public API
|
278
292
|
test_files: []
|
293
|
+
has_rdoc:
|