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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 4c5c9a4689f859c91d6f9e12a65fe4c13196d733
4
- data.tar.gz: a65ca0cf2f4d6f2f026a4ebded38a730d8e3f711
2
+ SHA256:
3
+ metadata.gz: 6203aae357be0e2f7e024ce9b58eb4218e123395ba766c0ef844c1d7f72861d6
4
+ data.tar.gz: 6798d8ebdc12b1e6d17f5b7d19aa0687742059f179170179db9b388e18fb385a
5
5
  SHA512:
6
- metadata.gz: 1f8d6235ac3e8d2f0cd2cca00f46b7d54b685da31fe5a279ee1ac193cdb1b0c46cb7076be4cd12727b98d5e69222a7a54585e97e8fc77569c19a25158f97dcb0
7
- data.tar.gz: e4dd70f84eb317b0c09f8981729fe6ed3a042ce377d7b3fa2942d514b56bf495cc5a7c0668228defbee82d922244696b7417b946191b1c6f4092272e327acb63
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
- url = DaisybillApi::Data::Url.build(path).to_s
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
@@ -13,7 +13,7 @@ module DaisybillApi
13
13
  host: DaisybillApi.configuration.host,
14
14
  port: port,
15
15
  path: "#{DEFAULT_PATH}#{path}",
16
- query: to_query(params.merge api_token: DaisybillApi.configuration.api_token)
16
+ query: to_query(params)
17
17
  })
18
18
  end
19
19
 
@@ -1,3 +1,3 @@
1
1
  module DaisybillApi
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.9"
3
3
  end
data/lib/daisybill_api.rb CHANGED
@@ -2,6 +2,7 @@ require "daisybill_api/data"
2
2
  require "daisybill_api/configuration"
3
3
  require "daisybill_api/ext"
4
4
  require "daisybill_api/models"
5
+ require "daisybill_api/version"
5
6
 
6
7
  module DaisybillApi
7
8
  # @private
@@ -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
@@ -9,5 +9,4 @@ describe DaisybillApi::Data::Url do
9
9
 
10
10
  it { is_expected.to include "page=1" }
11
11
  it { is_expected.to include "per_page=20" }
12
- it { is_expected.to include "api_token=token" }
13
12
  end
@@ -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?api_token=api+token" }
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?api_token=api+token") }
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?api_token") }
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.6
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: 2018-04-20 00:00:00.000000000 Z
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: '2.9'
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: '2.9'
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: '1.20'
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: '1.20'
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
- rubyforge_project:
288
- rubygems_version: 2.5.2
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/remittance_spec.rb
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/service_line_item_payment_spec.rb
326
- - spec/daisybill_api/models/service_line_item_spec.rb
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