daisybill_api 0.1.6 → 0.1.9
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 +5 -5
- data/lib/daisybill_api/data/client.rb +11 -2
- data/lib/daisybill_api/data/url.rb +1 -1
- data/lib/daisybill_api/version.rb +1 -1
- data/lib/daisybill_api.rb +1 -0
- data/spec/daisybill_api/data/client_get_request_params_spec.rb +51 -0
- data/spec/daisybill_api/data/url_spec.rb +0 -1
- data/spec/daisybill_api_spec.rb +3 -3
- metadata +39 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6203aae357be0e2f7e024ce9b58eb4218e123395ba766c0ef844c1d7f72861d6
|
|
4
|
+
data.tar.gz: 6798d8ebdc12b1e6d17f5b7d19aa0687742059f179170179db9b388e18fb385a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d2430cf9cef4964ba0b5d44e3dd538528f2cd26a0444d511c798d2e52a181713f7c97929da513bbd0ebb241e17e494855d9c3142447cc10cf28bc88bd1df11b2
|
|
7
|
+
data.tar.gz: 9171aec48bd6ddb00ba5a616391241b9d220949ac69651d65196eeca69eb46be0631f1cecd27525b5316a9187f6671cac478a5c2891582ae52cbeeb37f6fd1bb
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "rest-client"
|
|
2
|
+
require "json"
|
|
2
3
|
|
|
3
4
|
module DaisybillApi
|
|
4
5
|
# @private
|
|
@@ -24,11 +25,19 @@ module DaisybillApi
|
|
|
24
25
|
def initialize(method, path, params = {})
|
|
25
26
|
DaisybillApi.logger.info "#{method.to_s.upcase} #{path}"
|
|
26
27
|
DaisybillApi.logger.debug params.inspect
|
|
27
|
-
|
|
28
|
+
if method == :get
|
|
29
|
+
url = DaisybillApi::Data::Url.build(path, params).to_s
|
|
30
|
+
else
|
|
31
|
+
url = DaisybillApi::Data::Url.build(path).to_s
|
|
32
|
+
end
|
|
28
33
|
data = {
|
|
29
34
|
method: method,
|
|
30
35
|
url: url,
|
|
31
|
-
payload: params
|
|
36
|
+
payload: method == :get ? nil : params,
|
|
37
|
+
headers: {
|
|
38
|
+
"Authorization" => "Bearer #{DaisybillApi.configuration.api_token}",
|
|
39
|
+
"User-Agent" => "DaisyBill_API/#{DaisybillApi::VERSION}",
|
|
40
|
+
}
|
|
32
41
|
}
|
|
33
42
|
RestClient::Request.execute(data) { |response, request, status|
|
|
34
43
|
@headers = response.headers
|
data/lib/daisybill_api.rb
CHANGED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
require "webmock/rspec"
|
|
3
|
+
|
|
4
|
+
describe DaisybillApi::Data::Client, "GET request params handling" do
|
|
5
|
+
before do
|
|
6
|
+
DaisybillApi.configure do |config|
|
|
7
|
+
config.api_token = "test-token"
|
|
8
|
+
config.host = "go.daisybill.com"
|
|
9
|
+
config.port = 443
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
let(:response_body) { { "payers" => [{ "id" => 1, "name" => "Test Payer" }] }.to_json }
|
|
14
|
+
|
|
15
|
+
describe "GET requests" do
|
|
16
|
+
it "does not include a request body" do
|
|
17
|
+
stub = stub_request(:get, %r{go.daisybill.com/api/v1/claims_administrators/2985/payers})
|
|
18
|
+
.with { |request| request.body.nil? || request.body.empty? }
|
|
19
|
+
.to_return(status: 200, body: response_body, headers: { "Content-Type" => "application/json" })
|
|
20
|
+
|
|
21
|
+
DaisybillApi::Data::Client.new(:get, "/claims_administrators/2985/payers", { claims_administrator_id: 2985 })
|
|
22
|
+
|
|
23
|
+
expect(stub).to have_been_requested
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it "sends params as query string parameters" do
|
|
27
|
+
stub = stub_request(:get, %r{go.daisybill.com/api/v1/claims_administrators/2985/payers})
|
|
28
|
+
.with(query: hash_including("claims_administrator_id" => "2985"))
|
|
29
|
+
.to_return(status: 200, body: response_body, headers: { "Content-Type" => "application/json" })
|
|
30
|
+
|
|
31
|
+
DaisybillApi::Data::Client.new(:get, "/claims_administrators/2985/payers", { claims_administrator_id: 2985 })
|
|
32
|
+
|
|
33
|
+
expect(stub).to have_been_requested
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
describe "POST requests" do
|
|
38
|
+
let(:post_response_body) { { "id" => 1, "name" => "Test" }.to_json }
|
|
39
|
+
|
|
40
|
+
it "sends params as a request body" do
|
|
41
|
+
stub = stub_request(:post, %r{go.daisybill.com/api/v1/patients})
|
|
42
|
+
.with { |request| !request.body.nil? && !request.body.empty? }
|
|
43
|
+
.to_return(status: 201, body: post_response_body, headers: { "Content-Type" => "application/json" })
|
|
44
|
+
|
|
45
|
+
params = { patient: { first_name: "John", last_name: "Smith" } }
|
|
46
|
+
DaisybillApi::Data::Client.new(:post, "/patients", params)
|
|
47
|
+
|
|
48
|
+
expect(stub).to have_been_requested
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
data/spec/daisybill_api_spec.rb
CHANGED
|
@@ -17,18 +17,18 @@ describe DaisybillApi do
|
|
|
17
17
|
|
|
18
18
|
subject { DaisybillApi::Data::Url.build("/billing_providers").to_s }
|
|
19
19
|
|
|
20
|
-
it { is_expected.to eq "https://go.daisybill.com/api/v1/billing_providers?
|
|
20
|
+
it { is_expected.to eq "https://go.daisybill.com/api/v1/billing_providers?" }
|
|
21
21
|
|
|
22
22
|
context "when host and port changed" do
|
|
23
23
|
let(:host) { "localhost" }
|
|
24
24
|
let(:port) { 3000 }
|
|
25
25
|
|
|
26
|
-
it { is_expected.to eq("http://localhost:3000/api/v1/billing_providers?
|
|
26
|
+
it { is_expected.to eq("http://localhost:3000/api/v1/billing_providers?") }
|
|
27
27
|
|
|
28
28
|
context "after reset" do
|
|
29
29
|
before { DaisybillApi.reset_configuration }
|
|
30
30
|
|
|
31
|
-
it { is_expected.to eq("https://go.daisybill.com/api/v1/billing_providers?
|
|
31
|
+
it { is_expected.to eq("https://go.daisybill.com/api/v1/billing_providers?") }
|
|
32
32
|
end
|
|
33
33
|
end
|
|
34
34
|
end
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: daisybill_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.9
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Liscio
|
|
8
8
|
- Eugene Surzhko
|
|
9
9
|
- Joe Leo
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2026-03-24 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: activemodel
|
|
@@ -44,14 +44,14 @@ dependencies:
|
|
|
44
44
|
name: bundler
|
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
|
47
|
-
- - "
|
|
47
|
+
- - ">="
|
|
48
48
|
- !ruby/object:Gem::Version
|
|
49
49
|
version: '1.7'
|
|
50
50
|
type: :development
|
|
51
51
|
prerelease: false
|
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
53
|
requirements:
|
|
54
|
-
- - "
|
|
54
|
+
- - ">="
|
|
55
55
|
- !ruby/object:Gem::Version
|
|
56
56
|
version: '1.7'
|
|
57
57
|
- !ruby/object:Gem::Dependency
|
|
@@ -130,28 +130,28 @@ dependencies:
|
|
|
130
130
|
requirements:
|
|
131
131
|
- - "~>"
|
|
132
132
|
- !ruby/object:Gem::Version
|
|
133
|
-
version: '
|
|
133
|
+
version: '6.3'
|
|
134
134
|
type: :development
|
|
135
135
|
prerelease: false
|
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
|
137
137
|
requirements:
|
|
138
138
|
- - "~>"
|
|
139
139
|
- !ruby/object:Gem::Version
|
|
140
|
-
version: '
|
|
140
|
+
version: '6.3'
|
|
141
141
|
- !ruby/object:Gem::Dependency
|
|
142
142
|
name: webmock
|
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
|
144
144
|
requirements:
|
|
145
145
|
- - "~>"
|
|
146
146
|
- !ruby/object:Gem::Version
|
|
147
|
-
version: '
|
|
147
|
+
version: '3.25'
|
|
148
148
|
type: :development
|
|
149
149
|
prerelease: false
|
|
150
150
|
version_requirements: !ruby/object:Gem::Requirement
|
|
151
151
|
requirements:
|
|
152
152
|
- - "~>"
|
|
153
153
|
- !ruby/object:Gem::Version
|
|
154
|
-
version: '
|
|
154
|
+
version: '3.25'
|
|
155
155
|
- !ruby/object:Gem::Dependency
|
|
156
156
|
name: yard
|
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -229,6 +229,7 @@ files:
|
|
|
229
229
|
- lib/daisybill_api/models/user.rb
|
|
230
230
|
- lib/daisybill_api/version.rb
|
|
231
231
|
- spec/daisybill_api/configuration_spec.rb
|
|
232
|
+
- spec/daisybill_api/data/client_get_request_params_spec.rb
|
|
232
233
|
- spec/daisybill_api/data/client_spec.rb
|
|
233
234
|
- spec/daisybill_api/data/rest_client/payload_spec.rb
|
|
234
235
|
- spec/daisybill_api/data/url_spec.rb
|
|
@@ -269,7 +270,7 @@ homepage: https://www.daisybill.com
|
|
|
269
270
|
licenses:
|
|
270
271
|
- MIT
|
|
271
272
|
metadata: {}
|
|
272
|
-
post_install_message:
|
|
273
|
+
post_install_message:
|
|
273
274
|
rdoc_options: []
|
|
274
275
|
require_paths:
|
|
275
276
|
- lib
|
|
@@ -284,46 +285,46 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
284
285
|
- !ruby/object:Gem::Version
|
|
285
286
|
version: '0'
|
|
286
287
|
requirements: []
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
signing_key:
|
|
288
|
+
rubygems_version: 3.1.6
|
|
289
|
+
signing_key:
|
|
290
290
|
specification_version: 4
|
|
291
291
|
summary: ActiveRecord style wrapper for DaisyBill's API
|
|
292
292
|
test_files:
|
|
293
293
|
- spec/daisybill_api/configuration_spec.rb
|
|
294
|
-
- spec/daisybill_api/data/client_spec.rb
|
|
295
|
-
- spec/daisybill_api/data/rest_client/payload_spec.rb
|
|
296
|
-
- spec/daisybill_api/data/url_spec.rb
|
|
297
|
-
- spec/daisybill_api/ext/attributes/attribute_spec.rb
|
|
298
294
|
- spec/daisybill_api/ext/attributes/type_castings_spec.rb
|
|
295
|
+
- spec/daisybill_api/ext/attributes/attribute_spec.rb
|
|
299
296
|
- spec/daisybill_api/ext/links/link_spec.rb
|
|
300
297
|
- spec/daisybill_api/ext/pageable_collection_spec.rb
|
|
301
|
-
- spec/daisybill_api/models/address_spec.rb
|
|
302
|
-
- spec/daisybill_api/models/attachment_spec.rb
|
|
303
|
-
- spec/daisybill_api/models/bill_mailing_address_spec.rb
|
|
304
|
-
- spec/daisybill_api/models/bill_payment_spec.rb
|
|
305
|
-
- spec/daisybill_api/models/bill_spec.rb
|
|
306
|
-
- spec/daisybill_api/models/bill_submission_spec.rb
|
|
307
|
-
- spec/daisybill_api/models/billing_provider_spec.rb
|
|
308
|
-
- spec/daisybill_api/models/claim_number_verification_spec.rb
|
|
309
|
-
- spec/daisybill_api/models/claims_administrator_spec.rb
|
|
310
298
|
- spec/daisybill_api/models/contact_spec.rb
|
|
311
|
-
- spec/daisybill_api/models/disputed_service_spec.rb
|
|
312
|
-
- spec/daisybill_api/models/employer_spec.rb
|
|
313
|
-
- spec/daisybill_api/models/error_report_spec.rb
|
|
314
|
-
- spec/daisybill_api/models/injury_spec.rb
|
|
315
|
-
- spec/daisybill_api/models/paper_eor_spec.rb
|
|
316
|
-
- spec/daisybill_api/models/patient_spec.rb
|
|
317
|
-
- spec/daisybill_api/models/payer_spec.rb
|
|
318
|
-
- spec/daisybill_api/models/pharmacy_bill_spec.rb
|
|
319
|
-
- spec/daisybill_api/models/place_of_service_spec.rb
|
|
320
299
|
- spec/daisybill_api/models/prescribing_provider_spec.rb
|
|
300
|
+
- spec/daisybill_api/models/claims_administrator_spec.rb
|
|
321
301
|
- spec/daisybill_api/models/referring_provider_spec.rb
|
|
322
|
-
- spec/daisybill_api/models/
|
|
302
|
+
- spec/daisybill_api/models/disputed_service_spec.rb
|
|
303
|
+
- spec/daisybill_api/models/bill_spec.rb
|
|
323
304
|
- spec/daisybill_api/models/rendering_provider_spec.rb
|
|
324
305
|
- spec/daisybill_api/models/request_for_second_review_spec.rb
|
|
325
|
-
- spec/daisybill_api/models/
|
|
326
|
-
- spec/daisybill_api/models/
|
|
306
|
+
- spec/daisybill_api/models/claim_number_verification_spec.rb
|
|
307
|
+
- spec/daisybill_api/models/payer_spec.rb
|
|
327
308
|
- spec/daisybill_api/models/task_spec.rb
|
|
309
|
+
- spec/daisybill_api/models/billing_provider_spec.rb
|
|
310
|
+
- spec/daisybill_api/models/bill_payment_spec.rb
|
|
311
|
+
- spec/daisybill_api/models/attachment_spec.rb
|
|
312
|
+
- spec/daisybill_api/models/error_report_spec.rb
|
|
313
|
+
- spec/daisybill_api/models/pharmacy_bill_spec.rb
|
|
314
|
+
- spec/daisybill_api/models/employer_spec.rb
|
|
315
|
+
- spec/daisybill_api/models/patient_spec.rb
|
|
316
|
+
- spec/daisybill_api/models/bill_submission_spec.rb
|
|
317
|
+
- spec/daisybill_api/models/service_line_item_spec.rb
|
|
318
|
+
- spec/daisybill_api/models/service_line_item_payment_spec.rb
|
|
319
|
+
- spec/daisybill_api/models/place_of_service_spec.rb
|
|
320
|
+
- spec/daisybill_api/models/paper_eor_spec.rb
|
|
328
321
|
- spec/daisybill_api/models/user_spec.rb
|
|
322
|
+
- spec/daisybill_api/models/remittance_spec.rb
|
|
323
|
+
- spec/daisybill_api/models/injury_spec.rb
|
|
324
|
+
- spec/daisybill_api/models/address_spec.rb
|
|
325
|
+
- spec/daisybill_api/models/bill_mailing_address_spec.rb
|
|
326
|
+
- spec/daisybill_api/data/client_spec.rb
|
|
327
|
+
- spec/daisybill_api/data/url_spec.rb
|
|
328
|
+
- spec/daisybill_api/data/rest_client/payload_spec.rb
|
|
329
|
+
- spec/daisybill_api/data/client_get_request_params_spec.rb
|
|
329
330
|
- spec/daisybill_api_spec.rb
|