avatax 25.3.2 → 25.3.3

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: 636a2a796b563ec657ad339a38b1a219f4c283a55044ab0f310ffbd966b94490
4
- data.tar.gz: 6e21a8e656ab4264ec9d205112990f13a8817dd0170a29b072630b84f7c3fe94
3
+ metadata.gz: 9508ea51c880c6d5dee5cd33bf392bcfe1ceb94d15f5d2a361744669999619c0
4
+ data.tar.gz: c69c43ea15a4a19bbfa16a41398b0a79a9f589561570fc1f28d3b9256ba98c8c
5
5
  SHA512:
6
- metadata.gz: e0f8be9f117e6457d3c4a848b7875bb20dee509e17d3a0f97a52d28e5bdbe2bde328972625a48c8c96b84222566354fcbbba1da325365eb3e4a3e99d5513b1f8
7
- data.tar.gz: b7911f826295bcfce26e1aaf9b2b67f3bfd768c111ec4668c248a0f56533a929544ce080d85b00f62b804743941a7ec819e23628f32a8bea9a19fcb0f05853cb
6
+ metadata.gz: e26875ce9c8c8764c861907f2f28e538a965820b3df4399c035c3ab0e86a48d453d4ed2508633d077a2b8ac800d80833eba023bbe76b03a5e060245f32fb0315
7
+ data.tar.gz: 0a209ba299d7d5068a155e5ad9bd3dbb8413052ce1efbf5410507b14ea909624ffdd235af488000e78de3ba41a0b9796b00678ba2f9391636b4c9e2e91ffd5a0
@@ -6,26 +6,43 @@ on:
6
6
 
7
7
  jobs:
8
8
  build:
9
- name: Build + Publish
9
+ name: Build + Test + Publish
10
10
  runs-on: ubuntu-latest
11
11
  permissions:
12
12
  contents: read
13
13
  packages: write
14
14
 
15
15
  steps:
16
- - uses: actions/checkout@v2
17
- - name: Set up Ruby 2.6
18
- uses: ruby/setup-ruby@v1
19
- with:
20
- ruby-version: '2.6'
21
-
22
- - name: Publish to RubyGems
23
- run: |
24
- mkdir -p $HOME/.gem
25
- touch $HOME/.gem/credentials
26
- chmod 0600 $HOME/.gem/credentials
27
- printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
28
- gem build avatax.gemspec
29
- gem push *.gem
30
- env:
31
- GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
16
+ - uses: actions/checkout@v2
17
+
18
+ - name: Set up Ruby 2.6
19
+ uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: "2.6"
22
+ bundler-cache: true # Caches gems between runs
23
+
24
+ - name: Write AvaTax credentials to credentials.yaml
25
+ run: |
26
+ cat <<EOF > spec/credentials.yaml
27
+ endpoint: https://sandbox-rest.avatax.com
28
+ username: "${{ secrets.SANDBOX_USERNAME }}"
29
+ password: "${{ secrets.SANDBOX_PASSWORD }}"
30
+ EOF
31
+
32
+ - name: Install dependencies
33
+ run: bundle install
34
+
35
+ - name: Run RSpec tests
36
+ run: bundle exec rspec
37
+
38
+ - name: Publish to RubyGems
39
+ if: success() # Only runs if tests pass
40
+ run: |
41
+ mkdir -p $HOME/.gem
42
+ touch $HOME/.gem/credentials
43
+ chmod 0600 $HOME/.gem/credentials
44
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
45
+ gem build avatax.gemspec
46
+ gem push *.gem
47
+ env:
48
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -18,6 +18,10 @@ module AvaTax
18
18
  request(:put, path, model, options, apiversion, headers)
19
19
  end
20
20
 
21
+ def patch(path, model, options={}, apiversion="", headers=Hash.new)
22
+ request(:patch, path, model, options, apiversion, headers)
23
+ end
24
+
21
25
  def delete(path, options={}, apiversion="", headers=Hash.new)
22
26
  request(:delete, path, nil, options, apiversion, headers)
23
27
  end
@@ -29,7 +33,7 @@ module AvaTax
29
33
  case method
30
34
  when :get, :delete
31
35
  request.url("#{encode_path(path)}?#{URI.encode_www_form(options)}")
32
- when :post, :put
36
+ when :post, :put, :patch
33
37
  request.url("#{encode_path(path)}?#{URI.encode_www_form(options)}")
34
38
  request.headers['Content-Type'] = 'application/json'
35
39
  request.body = model.to_json unless model.empty?
@@ -1,3 +1,3 @@
1
1
  module AvaTax
2
- VERSION = '25.3.2'.freeze unless defined?(::AvaTax::VERSION)
2
+ VERSION = '25.3.3'.freeze unless defined?(::AvaTax::VERSION)
3
3
  end
@@ -0,0 +1,51 @@
1
+ require File.expand_path('../../../spec_helper', __FILE__)
2
+
3
+ describe AvaTax::Client do
4
+ describe ".items" do
5
+ it "should create and update an item for the first company" do
6
+ # Get the first company
7
+ companies = @client.query_companies()
8
+ company = companies["value"][0]
9
+ company_id = company["id"]
10
+ puts "Using company ID: #{company_id}"
11
+
12
+ # Create a new item
13
+ item_code = "TEST_ITEM_#{Time.now.to_i}"
14
+ item_model = {
15
+ "itemCode" => item_code,
16
+ "description" => "Test Item Created via RSpec",
17
+ "taxCode" => "P0000000"
18
+ }
19
+
20
+ created_response = @client.create_items(company_id, [item_model])
21
+ created_item = created_response.first
22
+
23
+ # Assert item creation
24
+ expect(created_item).to be_a(Hash)
25
+ expect(created_item["itemCode"]).to eq(item_code)
26
+ expect(created_item["description"]).to eq("Test Item Created via RSpec")
27
+ expect(created_item["taxCode"]).to eq("P0000000")
28
+
29
+ puts "Created item: #{created_item}"
30
+
31
+ # Prepare JSON Patch operation
32
+ item_id = created_item["id"]
33
+ patch_operations = [
34
+ {
35
+ "op" => "replace",
36
+ "path" => "/description",
37
+ "value" => "Updated Description via RSpec"
38
+ }
39
+ ]
40
+
41
+ # Call patch_item
42
+ updated_item = @client.patch_item(company_id, item_id, patch_operations)
43
+
44
+ expect(updated_item).to be_a(Hash)
45
+ expect(updated_item["id"]).to eq(item_id)
46
+ expect(updated_item["description"]).to eq("Updated Description via RSpec")
47
+
48
+ puts "Updated item: #{updated_item}"
49
+ end
50
+ end
51
+ end
data/spec/spec_helper.rb CHANGED
@@ -16,12 +16,17 @@ AvaTax.configure do |config|
16
16
  end
17
17
  end
18
18
 
19
- client = AvaTax::Client.new({ :logger => true, :log_request_and_response_info => true })
19
+ client = AvaTax::Client.new({ logger: true, log_request_and_response_info: true })
20
20
  companies = client.query_companies
21
21
 
22
+ # Find the first active company manually
23
+ active_company = companies["value"].find { |company| company["isActive"] == true }
24
+
25
+ raise "No active company found" unless active_company
26
+
22
27
  RSpec.configure do |config|
23
28
  config.before {
24
29
  @client = client
25
- @company_code = companies["value"][0]["companyCode"]
30
+ @company_code = active_company["companyCode"]
26
31
  }
27
32
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avatax
3
3
  version: !ruby/object:Gem::Version
4
- version: 25.3.2
4
+ version: 25.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marcus Vorwaller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-27 00:00:00.000000000 Z
11
+ date: 2025-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -180,6 +180,7 @@ files:
180
180
  - lib/avatax/request.rb
181
181
  - lib/avatax/version.rb
182
182
  - spec/avatax/client/accounts_spec.rb
183
+ - spec/avatax/client/items_spec.rb
183
184
  - spec/avatax/client/transactions_spec.rb
184
185
  - spec/avatax/request_spec.rb
185
186
  - spec/avatax_spec.rb