daisybill_api 0.1.7 → 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
2
  SHA256:
3
- metadata.gz: 68f13995a338c7e6134fce1f0ff5cd3066588dc038b0b6702aebd64cc50105e9
4
- data.tar.gz: cede9671b6669d12037ab95a7c64c7bdacd6ec3d0b29523b8a4cf4a4ec9a0609
3
+ metadata.gz: 6203aae357be0e2f7e024ce9b58eb4218e123395ba766c0ef844c1d7f72861d6
4
+ data.tar.gz: 6798d8ebdc12b1e6d17f5b7d19aa0687742059f179170179db9b388e18fb385a
5
5
  SHA512:
6
- metadata.gz: b893b82610e301856f2bdfde112e49573cdf4d56779be096ec1458de8af589302b99080b946fff23bf0775e505d5261f75141720465605d714506f0689cbfb5d
7
- data.tar.gz: 51d4039273ea91137348d6a6f07fc1ffc8b7f9a77a9fbf15e06e2e42a36935187356065fe44f6d5aba9bfb37862c57f391f011ad682ccdd6935c6cbfd1b721ed
6
+ metadata.gz: d2430cf9cef4964ba0b5d44e3dd538528f2cd26a0444d511c798d2e52a181713f7c97929da513bbd0ebb241e17e494855d9c3142447cc10cf28bc88bd1df11b2
7
+ data.tar.gz: 9171aec48bd6ddb00ba5a616391241b9d220949ac69651d65196eeca69eb46be0631f1cecd27525b5316a9187f6671cac478a5c2891582ae52cbeeb37f6fd1bb
@@ -25,11 +25,15 @@ module DaisybillApi
25
25
  def initialize(method, path, params = {})
26
26
  DaisybillApi.logger.info "#{method.to_s.upcase} #{path}"
27
27
  DaisybillApi.logger.debug params.inspect
28
- 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
29
33
  data = {
30
34
  method: method,
31
35
  url: url,
32
- payload: params,
36
+ payload: method == :get ? nil : params,
33
37
  headers: {
34
38
  "Authorization" => "Bearer #{DaisybillApi.configuration.api_token}",
35
39
  "User-Agent" => "DaisyBill_API/#{DaisybillApi::VERSION}",
@@ -1,3 +1,3 @@
1
1
  module DaisybillApi
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.9"
3
3
  end
@@ -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
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.7
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: 2023-09-29 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,8 +285,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
285
  - !ruby/object:Gem::Version
285
286
  version: '0'
286
287
  requirements: []
287
- rubygems_version: 3.1.4
288
- signing_key:
288
+ rubygems_version: 3.1.6
289
+ signing_key:
289
290
  specification_version: 4
290
291
  summary: ActiveRecord style wrapper for DaisyBill's API
291
292
  test_files:
@@ -325,4 +326,5 @@ test_files:
325
326
  - spec/daisybill_api/data/client_spec.rb
326
327
  - spec/daisybill_api/data/url_spec.rb
327
328
  - spec/daisybill_api/data/rest_client/payload_spec.rb
329
+ - spec/daisybill_api/data/client_get_request_params_spec.rb
328
330
  - spec/daisybill_api_spec.rb