truepill 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/workflows/run-tests.yml +25 -0
- data/.gitignore +19 -0
- data/.rspec +3 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +83 -0
- data/LICENSE.txt +21 -0
- data/README.md +42 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/truepill/configuration.rb +32 -0
- data/lib/truepill/request.rb +101 -0
- data/lib/truepill/resources/copay_request.rb +7 -0
- data/lib/truepill/resources/coverage_request.rb +7 -0
- data/lib/truepill/resources/fill_request.rb +19 -0
- data/lib/truepill/resources/insurance.rb +7 -0
- data/lib/truepill/resources/insurance_claim.rb +7 -0
- data/lib/truepill/resources/patient.rb +17 -0
- data/lib/truepill/resources/prescription.rb +7 -0
- data/lib/truepill/resources/prior_authorization.rb +7 -0
- data/lib/truepill/response.rb +61 -0
- data/lib/truepill/restful_resource.rb +55 -0
- data/lib/truepill/version.rb +3 -0
- data/lib/truepill.rb +28 -0
- data/truepill.gemspec +35 -0
- metadata +180 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 766165a69220f363481be397f6733b0297b43b4283b751d56e46d7cb25047b44
|
|
4
|
+
data.tar.gz: 2b246b3fb4d31ea7db811cd203a2fbfc20edd32dbc22c240b4b4593022fea128
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: ab35d34b362b5a51cf837099439aa769f90867eee29ed56f3dc906087ab74d1a91cd4e4d97b811e916524de88f4bb12f3ba50a9866056222de9b8479443a4359
|
|
7
|
+
data.tar.gz: 662910d18c3e62d280d0fa1d6c31861a67dc81b6e3ce0b0f598d1d25cd185a0c270be722bafb807881cc18156b0d9596e802c32ee7da2d24703406a636f385fc
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
|
2
|
+
# They are provided by a third-party and are governed by
|
|
3
|
+
# separate terms of service, privacy policy, and support
|
|
4
|
+
# documentation.
|
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
7
|
+
|
|
8
|
+
name: Ruby
|
|
9
|
+
|
|
10
|
+
on:
|
|
11
|
+
push:
|
|
12
|
+
|
|
13
|
+
jobs:
|
|
14
|
+
test:
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v2
|
|
18
|
+
- name: Set up Ruby
|
|
19
|
+
uses: ruby/setup-ruby@v1
|
|
20
|
+
with:
|
|
21
|
+
ruby-version: 2.4.6
|
|
22
|
+
- name: Install dependencies
|
|
23
|
+
run: bundle install
|
|
24
|
+
- name: Run tests
|
|
25
|
+
run: bundle exec rspec
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
truepill (0.0.8)
|
|
5
|
+
activesupport (~> 5.2.4)
|
|
6
|
+
httparty (~> 0.18)
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
activesupport (5.2.6)
|
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
13
|
+
i18n (>= 0.7, < 2)
|
|
14
|
+
minitest (~> 5.1)
|
|
15
|
+
tzinfo (~> 1.1)
|
|
16
|
+
addressable (2.7.0)
|
|
17
|
+
public_suffix (>= 2.0.2, < 5.0)
|
|
18
|
+
byebug (11.1.3)
|
|
19
|
+
coderay (1.1.3)
|
|
20
|
+
concurrent-ruby (1.1.9)
|
|
21
|
+
crack (0.4.4)
|
|
22
|
+
diff-lcs (1.3)
|
|
23
|
+
docile (1.3.2)
|
|
24
|
+
hashdiff (1.0.1)
|
|
25
|
+
httparty (0.20.0)
|
|
26
|
+
mime-types (~> 3.0)
|
|
27
|
+
multi_xml (>= 0.5.2)
|
|
28
|
+
i18n (1.8.11)
|
|
29
|
+
concurrent-ruby (~> 1.0)
|
|
30
|
+
method_source (1.0.0)
|
|
31
|
+
mime-types (3.4.1)
|
|
32
|
+
mime-types-data (~> 3.2015)
|
|
33
|
+
mime-types-data (3.2021.1115)
|
|
34
|
+
minitest (5.14.4)
|
|
35
|
+
multi_xml (0.6.0)
|
|
36
|
+
pry (0.13.1)
|
|
37
|
+
coderay (~> 1.1)
|
|
38
|
+
method_source (~> 1.0)
|
|
39
|
+
public_suffix (4.0.6)
|
|
40
|
+
rake (13.0.1)
|
|
41
|
+
rspec (3.9.0)
|
|
42
|
+
rspec-core (~> 3.9.0)
|
|
43
|
+
rspec-expectations (~> 3.9.0)
|
|
44
|
+
rspec-mocks (~> 3.9.0)
|
|
45
|
+
rspec-core (3.9.2)
|
|
46
|
+
rspec-support (~> 3.9.3)
|
|
47
|
+
rspec-expectations (3.9.2)
|
|
48
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
49
|
+
rspec-support (~> 3.9.0)
|
|
50
|
+
rspec-its (1.3.0)
|
|
51
|
+
rspec-core (>= 3.0.0)
|
|
52
|
+
rspec-expectations (>= 3.0.0)
|
|
53
|
+
rspec-mocks (3.9.1)
|
|
54
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
55
|
+
rspec-support (~> 3.9.0)
|
|
56
|
+
rspec-support (3.9.3)
|
|
57
|
+
simplecov (0.18.5)
|
|
58
|
+
docile (~> 1.1)
|
|
59
|
+
simplecov-html (~> 0.11)
|
|
60
|
+
simplecov-html (0.12.3)
|
|
61
|
+
thread_safe (0.3.6)
|
|
62
|
+
tzinfo (1.2.9)
|
|
63
|
+
thread_safe (~> 0.1)
|
|
64
|
+
webmock (3.9.1)
|
|
65
|
+
addressable (>= 2.3.6)
|
|
66
|
+
crack (>= 0.3.2)
|
|
67
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
|
68
|
+
|
|
69
|
+
PLATFORMS
|
|
70
|
+
ruby
|
|
71
|
+
|
|
72
|
+
DEPENDENCIES
|
|
73
|
+
byebug
|
|
74
|
+
pry
|
|
75
|
+
rake (~> 13.0)
|
|
76
|
+
rspec (~> 3.0)
|
|
77
|
+
rspec-its (~> 1.3)
|
|
78
|
+
simplecov
|
|
79
|
+
truepill!
|
|
80
|
+
webmock (~> 3.8)
|
|
81
|
+
|
|
82
|
+
BUNDLED WITH
|
|
83
|
+
1.17.3
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Konstantin Raf; Cerebral, Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Truepill API Client
|
|
2
|
+
|
|
3
|
+
A ruby gem for the Truepill API.
|
|
4
|
+
|
|
5
|
+
Truepill API documentation: https://docs.truepill.com/#introduction
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'truepill'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install truepill
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
First configure the environment and credentials.
|
|
26
|
+
|
|
27
|
+
In a Rails app, this might go in `config/initializers/truepill.rb` for example.
|
|
28
|
+
|
|
29
|
+
```ruby
|
|
30
|
+
Truepill.configure do |config|
|
|
31
|
+
config.environment = Rails.env.production? ? :production : :sandbox
|
|
32
|
+
config.api_key = ENV['TRUEPILL_API_KEY']
|
|
33
|
+
end
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Contributing
|
|
37
|
+
|
|
38
|
+
Bug reports and pull requests are welcome on GitHub at: [https://github.com/cerebral-inc/truepill](https://github.com/cerebral-inc/truepill)
|
|
39
|
+
|
|
40
|
+
## License
|
|
41
|
+
|
|
42
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "truepill"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
module Truepill
|
|
2
|
+
##
|
|
3
|
+
# Truepill Configuration class
|
|
4
|
+
#
|
|
5
|
+
|
|
6
|
+
class Configuration
|
|
7
|
+
|
|
8
|
+
# [String] Environment to use - 'production' or 'sandbox'
|
|
9
|
+
attr_reader :environment
|
|
10
|
+
# [String] Client API Key (obtain from the Truepill portal)
|
|
11
|
+
attr_accessor :api_key
|
|
12
|
+
|
|
13
|
+
def initialize
|
|
14
|
+
# default to sandbox environment
|
|
15
|
+
@environment = :sandbox
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def production?
|
|
19
|
+
environment == :production
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def sandbox?
|
|
23
|
+
environment == :sandbox
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def environment=(environment = :sandbox)
|
|
27
|
+
@environment = environment.to_sym
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
require 'active_support/core_ext/module'
|
|
3
|
+
|
|
4
|
+
module Truepill
|
|
5
|
+
|
|
6
|
+
##
|
|
7
|
+
# Truepill Request class
|
|
8
|
+
#
|
|
9
|
+
# Represents an authenticated request to the Truepill API.
|
|
10
|
+
#
|
|
11
|
+
# Not used directly. RestfulResource inherits from this and implements the core, common
|
|
12
|
+
# methods used by the API.
|
|
13
|
+
#
|
|
14
|
+
|
|
15
|
+
class Request
|
|
16
|
+
include HTTParty
|
|
17
|
+
ssl_version :TLSv1_2
|
|
18
|
+
debug_output
|
|
19
|
+
|
|
20
|
+
def get(path)
|
|
21
|
+
perform_checks(path)
|
|
22
|
+
url = build_url(path)
|
|
23
|
+
response = send_authenticated(__callee__, url)
|
|
24
|
+
Response.new(response)
|
|
25
|
+
end
|
|
26
|
+
alias_method :delete, :get
|
|
27
|
+
|
|
28
|
+
def post(path, data = {})
|
|
29
|
+
perform_checks(path)
|
|
30
|
+
url = build_url(path)
|
|
31
|
+
response = send_authenticated(__callee__, url, data)
|
|
32
|
+
Response.new(response)
|
|
33
|
+
end
|
|
34
|
+
alias_method :put, :post
|
|
35
|
+
alias_method :patch, :post
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def send_authenticated(method, url, data = {})
|
|
40
|
+
if method == :get
|
|
41
|
+
options = {}
|
|
42
|
+
else
|
|
43
|
+
options = if (data.nil? || data.empty?)
|
|
44
|
+
{ body: nil }
|
|
45
|
+
elsif data[:multipart]
|
|
46
|
+
# don't covert to json here for multipart because it messes with files.
|
|
47
|
+
{ body: data, multipart: true }
|
|
48
|
+
else
|
|
49
|
+
{ body: data.to_json }
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
options.merge!(headers: headers(data))
|
|
53
|
+
|
|
54
|
+
response = self.class.public_send(
|
|
55
|
+
method, url, options
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
if response.code == 401
|
|
59
|
+
raise ::Truepill::AuthError, 'The token is invalid'
|
|
60
|
+
else
|
|
61
|
+
response
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def api_domain
|
|
66
|
+
if Truepill.configuration.production?
|
|
67
|
+
'api.truepill.com'
|
|
68
|
+
else
|
|
69
|
+
'api.falsepill.com'
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def build_url(path)
|
|
74
|
+
['https://', api_domain, '/v1/', path].join
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
JSON_CONTENT_TYPE = 'application/json'
|
|
78
|
+
MULTIPART_CONTENT_TYPE = 'multipart/form-data'
|
|
79
|
+
|
|
80
|
+
def headers(data = {})
|
|
81
|
+
content_type = data[:multipart] ? MULTIPART_CONTENT_TYPE : JSON_CONTENT_TYPE
|
|
82
|
+
{ Authorization: "ApiKey #{Truepill.configuration.api_key}",
|
|
83
|
+
'Content-Type': content_type }
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def perform_checks(path)
|
|
87
|
+
if Truepill.configuration.api_key.blank?
|
|
88
|
+
raise ::Truepill::AccessTokenNotPresentError, "Truepill access token not present"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# path must:
|
|
92
|
+
# * not be blank
|
|
93
|
+
# * contain a path besides just "/"
|
|
94
|
+
if path.blank? || path.gsub('/', '').empty?
|
|
95
|
+
raise ::Truepill::InvalidApiUrlError "Truepill API path passed appears invalid: #{path}"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
module Truepill
|
|
2
|
+
module Resources
|
|
3
|
+
class FillRequest < RestfulResource
|
|
4
|
+
public :create, :read
|
|
5
|
+
|
|
6
|
+
def update(id, data)
|
|
7
|
+
post('update_request', data.merge(request_id: id))
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def cancel(id)
|
|
11
|
+
post('cancel_request', { request_id: id })
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def update_payment(id, data)
|
|
15
|
+
post('update_fill_request_payment', data.merge(request_id: id))
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
module Truepill
|
|
2
|
+
module Resources
|
|
3
|
+
class Patient < RestfulResource
|
|
4
|
+
public :list, :read
|
|
5
|
+
|
|
6
|
+
def create(data)
|
|
7
|
+
put(resource_base, data)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def get_prescriptions(data)
|
|
11
|
+
path = "#{resource_path(data)}/prescriptions"
|
|
12
|
+
get(path)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
module Truepill
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# Truepill Response class
|
|
5
|
+
#
|
|
6
|
+
# Encapsulates a parsed json response from Truepill's API with methods
|
|
7
|
+
# for things like HTTP status codes, etc.
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
class Response
|
|
11
|
+
|
|
12
|
+
attr_reader :response
|
|
13
|
+
delegate :body, :code, :message, :headers, :parsed_response, to: :response
|
|
14
|
+
|
|
15
|
+
def initialize(response)
|
|
16
|
+
@response = response
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def success?
|
|
20
|
+
%w(success processed).include?(data[:status]) || !error?
|
|
21
|
+
rescue => e
|
|
22
|
+
false
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def error?
|
|
26
|
+
code.to_i / 100 != 2 || data[:statusCode] == 400
|
|
27
|
+
rescue => e
|
|
28
|
+
true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def errors
|
|
32
|
+
return ["Invalid response: #{body}"] unless data.is_a?(Hash)
|
|
33
|
+
data[:validation_errors]&.map do |error_data|
|
|
34
|
+
"#{error_data[:key]} #{error_data[:message]}"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def error_message
|
|
39
|
+
errors&.join(', ')
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
##
|
|
43
|
+
# Parsed response (e.g. Hash version of json received back)
|
|
44
|
+
#
|
|
45
|
+
|
|
46
|
+
def data
|
|
47
|
+
if parsed_response.is_a?(Hash)
|
|
48
|
+
parsed_response&.with_indifferent_access
|
|
49
|
+
elsif parsed_response.is_a?(Array)
|
|
50
|
+
parsed_response.map(&:with_indifferent_access)
|
|
51
|
+
else
|
|
52
|
+
parsed_response
|
|
53
|
+
end
|
|
54
|
+
rescue JSON::ParserError
|
|
55
|
+
# if the server sends an invalid response
|
|
56
|
+
body
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Truepill
|
|
2
|
+
|
|
3
|
+
##
|
|
4
|
+
# Truepill RestfulResource class
|
|
5
|
+
#
|
|
6
|
+
# Resource classes should inherit from this class. Defines core methods like list, create, read, update
|
|
7
|
+
# that can then be used by the subclasses by making the applicable methods available.
|
|
8
|
+
#
|
|
9
|
+
|
|
10
|
+
class RestfulResource < Request
|
|
11
|
+
|
|
12
|
+
protected
|
|
13
|
+
|
|
14
|
+
def list(params = {})
|
|
15
|
+
path = path_with_params(resource_base, params)
|
|
16
|
+
get(path)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def create(data)
|
|
20
|
+
post(resource_base, data)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def read(id)
|
|
24
|
+
get(resource_path(id))
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def destroy(id)
|
|
28
|
+
delete(resource_path(id))
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def replace(id, data)
|
|
32
|
+
put(resource_path(id), data)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def update(id, data)
|
|
36
|
+
patch(resource_path(id), data)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def resource_base
|
|
40
|
+
self.class.name.demodulize.underscore
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def resource_path(id)
|
|
44
|
+
"#{resource_base}/#{id}"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def path_with_params(path, params)
|
|
48
|
+
return path if params.blank?
|
|
49
|
+
|
|
50
|
+
[path, '/?', params.to_query].join
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
data/lib/truepill.rb
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# order matters
|
|
2
|
+
require "truepill/configuration"
|
|
3
|
+
require "truepill/request"
|
|
4
|
+
require "truepill/restful_resource"
|
|
5
|
+
require "truepill/response"
|
|
6
|
+
require "truepill/version"
|
|
7
|
+
|
|
8
|
+
resources_path = File.expand_path('truepill/resources/*.rb', File.dirname(__FILE__))
|
|
9
|
+
Dir[resources_path].each { |f| require f[/\/lib\/(.+)\.rb$/, 1] }
|
|
10
|
+
|
|
11
|
+
require 'active_support/core_ext/hash'
|
|
12
|
+
|
|
13
|
+
module Truepill
|
|
14
|
+
|
|
15
|
+
class AuthError < StandardError; end
|
|
16
|
+
class AccessTokenNotPresentError < StandardError; end
|
|
17
|
+
class InvalidApiUrlError < StandardError; end
|
|
18
|
+
|
|
19
|
+
class << self
|
|
20
|
+
attr_accessor :configuration
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def self.configure
|
|
24
|
+
self.configuration ||= Configuration.new
|
|
25
|
+
yield(configuration)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
data/truepill.gemspec
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require "truepill/version"
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = "truepill"
|
|
8
|
+
spec.version = Truepill::VERSION
|
|
9
|
+
spec.authors = ["Cerebral Inc., Shanti Braford, Konstantin Raf"]
|
|
10
|
+
spec.email = ["shanti@getcerebral.com"]
|
|
11
|
+
|
|
12
|
+
spec.summary = %q{Truepill API wrapper.}
|
|
13
|
+
spec.description = %q{A ruby library to interface with the Truepill API.}
|
|
14
|
+
spec.homepage = "https://github.com/cerebral-inc/truepill"
|
|
15
|
+
spec.license = "MIT"
|
|
16
|
+
|
|
17
|
+
# Specify which files should be added to the gem when it is released.
|
|
18
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
19
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
20
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
21
|
+
end
|
|
22
|
+
spec.bindir = "exe"
|
|
23
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
24
|
+
spec.require_paths = ["lib"]
|
|
25
|
+
|
|
26
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
27
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
|
28
|
+
spec.add_development_dependency "rspec-its", "~> 1.3"
|
|
29
|
+
spec.add_development_dependency "webmock", "~> 3.8"
|
|
30
|
+
spec.add_development_dependency "byebug"
|
|
31
|
+
spec.add_development_dependency "simplecov"
|
|
32
|
+
spec.add_runtime_dependency "httparty", "~> 0.18"
|
|
33
|
+
spec.add_runtime_dependency "activesupport", "~> 5.2.4"
|
|
34
|
+
|
|
35
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: truepill
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.8
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Cerebral Inc., Shanti Braford, Konstantin Raf
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2022-02-15 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rake
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '13.0'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '13.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rspec
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '3.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '3.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: rspec-its
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.3'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.3'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: webmock
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '3.8'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '3.8'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: byebug
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - ">="
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '0'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: simplecov
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: httparty
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0.18'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0.18'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: activesupport
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: 5.2.4
|
|
118
|
+
type: :runtime
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: 5.2.4
|
|
125
|
+
description: A ruby library to interface with the Truepill API.
|
|
126
|
+
email:
|
|
127
|
+
- shanti@getcerebral.com
|
|
128
|
+
executables: []
|
|
129
|
+
extensions: []
|
|
130
|
+
extra_rdoc_files: []
|
|
131
|
+
files:
|
|
132
|
+
- ".github/workflows/run-tests.yml"
|
|
133
|
+
- ".gitignore"
|
|
134
|
+
- ".rspec"
|
|
135
|
+
- Gemfile
|
|
136
|
+
- Gemfile.lock
|
|
137
|
+
- LICENSE.txt
|
|
138
|
+
- README.md
|
|
139
|
+
- Rakefile
|
|
140
|
+
- bin/console
|
|
141
|
+
- bin/setup
|
|
142
|
+
- lib/truepill.rb
|
|
143
|
+
- lib/truepill/configuration.rb
|
|
144
|
+
- lib/truepill/request.rb
|
|
145
|
+
- lib/truepill/resources/copay_request.rb
|
|
146
|
+
- lib/truepill/resources/coverage_request.rb
|
|
147
|
+
- lib/truepill/resources/fill_request.rb
|
|
148
|
+
- lib/truepill/resources/insurance.rb
|
|
149
|
+
- lib/truepill/resources/insurance_claim.rb
|
|
150
|
+
- lib/truepill/resources/patient.rb
|
|
151
|
+
- lib/truepill/resources/prescription.rb
|
|
152
|
+
- lib/truepill/resources/prior_authorization.rb
|
|
153
|
+
- lib/truepill/response.rb
|
|
154
|
+
- lib/truepill/restful_resource.rb
|
|
155
|
+
- lib/truepill/version.rb
|
|
156
|
+
- truepill.gemspec
|
|
157
|
+
homepage: https://github.com/cerebral-inc/truepill
|
|
158
|
+
licenses:
|
|
159
|
+
- MIT
|
|
160
|
+
metadata: {}
|
|
161
|
+
post_install_message:
|
|
162
|
+
rdoc_options: []
|
|
163
|
+
require_paths:
|
|
164
|
+
- lib
|
|
165
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
166
|
+
requirements:
|
|
167
|
+
- - ">="
|
|
168
|
+
- !ruby/object:Gem::Version
|
|
169
|
+
version: '0'
|
|
170
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
|
+
requirements:
|
|
172
|
+
- - ">="
|
|
173
|
+
- !ruby/object:Gem::Version
|
|
174
|
+
version: '0'
|
|
175
|
+
requirements: []
|
|
176
|
+
rubygems_version: 3.0.3.1
|
|
177
|
+
signing_key:
|
|
178
|
+
specification_version: 4
|
|
179
|
+
summary: Truepill API wrapper.
|
|
180
|
+
test_files: []
|