tsubaiso-sdk 1.2.20 → 1.2.21

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: 7ef76fa95446a467d1b3def8d5c774855b8aab004a7192eaa34b2368cd680f4d
4
- data.tar.gz: 4d5cae304c1ee1ec0b22fd4ba80031f33a0a789e3eb734aab5984e99a9b111b2
3
+ metadata.gz: 8b6828422e7286e0af8294254522c218e6adfbd07598bd3ba918052c8bef2d56
4
+ data.tar.gz: 7df346c71161ffc486ac5ce0adc46759149dc5578a869ca5338e638a4316b656
5
5
  SHA512:
6
- metadata.gz: a7624a8014cf5805a5242558efe7647fe1eb915917615bdc69d4c2919c16b029d37de332c41f4ffa370e6e8b3c64e1e123f653431e68ee5230826a783862531f
7
- data.tar.gz: 1e49a8c284e2e78b0215c3dad52b33bf8783d5774c12e082169108a4a655b690d4ca24ac7a3eb75056f9b6db3b46f91aff7ce3cc9f7b5c970a07480a6029b5ee
6
+ metadata.gz: 3c1a320b702a80a55635fdc0dfc82e41bda5cf945a77e398fa3d59119f5f33a1b577174af2acfcd316421e3a03597e3456594ba3f7b3ed71de972f313a5ecb92
7
+ data.tar.gz: caf94bcd710b755e0b2d0c0fa530f2ea0c5ff000251873e0afcd5139257e726a83fccaf782c2d77549316bc2f070f2f16e042a8e6be446edc35edefa8b2a0cd6
data/lib/tsubaiso_sdk.rb CHANGED
@@ -1306,6 +1306,7 @@ class TsubaisoSDK
1306
1306
  :use_in_balance,
1307
1307
  :status,
1308
1308
  :use_in_statement,
1309
+ :fc_revaluation_target,
1309
1310
  ]
1310
1311
  params = create_parameters(candidate_keys,options)
1311
1312
  uri = URI.parse(@base_url + '/account_masters/create')
@@ -1327,6 +1328,7 @@ class TsubaisoSDK
1327
1328
  :use_in_balance,
1328
1329
  :status,
1329
1330
  :use_in_statement,
1331
+ :fc_revaluation_target,
1330
1332
  ]
1331
1333
  params = create_parameters(candidate_keys,options)
1332
1334
  uri = URI.parse(@base_url + '/account_masters/update')
@@ -19,6 +19,12 @@ class StubRegister
19
19
  @common_request_headers.merge!( {"Access-Token" => token} )
20
20
  @created_records = []
21
21
 
22
+ # Special handling for account_masters
23
+ if resource == 'account_masters'
24
+ stub_account_masters
25
+ return
26
+ end
27
+
22
28
  stub_create(resource)
23
29
  stub_destroy(resource)
24
30
  stub_list(resource)
@@ -199,5 +205,43 @@ class StubRegister
199
205
  @created_records << return_body
200
206
  end
201
207
  end
208
+
209
+ def stub_account_masters
210
+ # Special handling for account_masters resource
211
+ create_request = load_json('account_masters', 'create', 'request')
212
+ create_response = load_json('account_masters', 'create', 'response')
213
+ create_without_fc_request = load_json('account_masters', 'create_without_fc', 'request')
214
+ create_without_fc_response = load_json('account_masters', 'create_without_fc', 'response')
215
+ update_request = load_json('account_masters', 'update', 'request')
216
+ update_response = load_json('account_masters', 'update', 'response')
217
+ update_partial_request = load_json('account_masters', 'update_partial', 'request')
218
+ update_partial_response = load_json('account_masters', 'update_partial', 'response')
219
+ list_response = load_json('account_masters', 'list', 'response')
220
+
221
+ # Stub create with fc_revaluation_target
222
+ if create_request && create_response
223
+ stub_requests(:post, url(@root_url, 'account_masters', 'create'), create_response, create_request)
224
+ end
225
+
226
+ # Stub create without fc_revaluation_target
227
+ if create_without_fc_request && create_without_fc_response
228
+ stub_requests(:post, url(@root_url, 'account_masters', 'create'), create_without_fc_response, create_without_fc_request)
229
+ end
230
+
231
+ # Stub update with all fields
232
+ if update_request && update_response
233
+ stub_requests(:post, url(@root_url, 'account_masters', 'update'), update_response, update_request)
234
+ end
235
+
236
+ # Stub update with partial fields
237
+ if update_partial_request && update_partial_response
238
+ stub_requests(:post, url(@root_url, 'account_masters', 'update'), update_partial_response, update_partial_request)
239
+ end
240
+
241
+ # Stub list
242
+ if list_response
243
+ stub_requests(:get, url(@root_url, 'account_masters', 'list'), list_response)
244
+ end
245
+ end
202
246
  end
203
247
 
@@ -0,0 +1,109 @@
1
+ require 'minitest/autorun'
2
+ require_relative './common_setup_and_teardown.rb'
3
+
4
+ class AccountMastersTest < Minitest::Test
5
+ include CommonSetupAndTeardown
6
+
7
+ def setup
8
+ @account_master_create = {
9
+ account_code: "777",
10
+ descid: "API_TEST",
11
+ account_name: "外部から作った",
12
+ account_kana: "API テスト",
13
+ dc: "d",
14
+ bspl: "bs",
15
+ brief: "Lorem Ipsum Dolor Sit Amet",
16
+ sum_no: "1",
17
+ use_in_balance: "1",
18
+ use_in_statement: "1",
19
+ status: "100",
20
+ inputtable: "1",
21
+ fc_revaluation_target: 1
22
+ }
23
+
24
+ @account_master_create_without_fc = {
25
+ account_code: "888",
26
+ descid: "API_TEST_2",
27
+ account_name: "外部から作った2",
28
+ account_kana: "API テスト2",
29
+ dc: "d",
30
+ bspl: "bs",
31
+ brief: "Lorem Ipsum",
32
+ sum_no: "1",
33
+ use_in_balance: "1",
34
+ use_in_statement: "1",
35
+ status: "100",
36
+ inputtable: "1"
37
+ }
38
+
39
+ @account_master_update = {
40
+ id: 42,
41
+ account_code: "888",
42
+ descid: "API_TEST_UPDATED",
43
+ account_name: "外部から作った[UPDATED]",
44
+ account_kana: "API テスト[UPDATED]",
45
+ dc: "c",
46
+ bspl: "pl",
47
+ brief: "Lorem Ipsum Dolor Sit Amet[UPDATED]",
48
+ sum_no: "2",
49
+ use_in_balance: "1",
50
+ use_in_statement: "1",
51
+ status: "100",
52
+ inputtable: "1",
53
+ fc_revaluation_target: 0
54
+ }
55
+
56
+ @account_master_update_without_fc = {
57
+ id: 42,
58
+ account_name: "外部から作った[NAME_ONLY_UPDATE]"
59
+ }
60
+
61
+ super("account_masters")
62
+ end
63
+
64
+ def test_list_account_masters
65
+ list = @api.list_account_masters
66
+ assert_equal 200, list[:status].to_i
67
+ assert list[:json].is_a?(Array)
68
+ assert list[:json].size > 0
69
+ end
70
+
71
+ def test_create_account_masters
72
+ created = @api.create_account_masters(@account_master_create)
73
+ assert_equal 200, created[:status].to_i
74
+ assert_equal @account_master_create[:account_code], created[:json][:account_code]
75
+ assert_equal @account_master_create[:account_name], created[:json][:account_name]
76
+ assert_equal @account_master_create[:descid], created[:json][:descid]
77
+ assert_equal @account_master_create[:fc_revaluation_target], created[:json][:fc_revaluation_target]
78
+ end
79
+
80
+ def test_create_account_masters_without_fc_revaluation_target
81
+ # fc_revaluation_targetを省略した場合、レスポンスには0またはnilが含まれる
82
+ # (DBのデフォルト値0が設定される)
83
+ # このテストは実際のAPIレスポンスに依存するため、
84
+ # スタブではcreate_responseを使用してfc_revaluation_target: 1を返す
85
+ # 実際のAPIではfc_revaluation_targetが省略されると0になる
86
+ created = @api.create_account_masters(@account_master_create_without_fc)
87
+ assert_equal 200, created[:status].to_i
88
+ assert_equal @account_master_create_without_fc[:account_code], created[:json][:account_code]
89
+ end
90
+
91
+ def test_update_account_masters
92
+ updated = @api.update_account_masters(@account_master_update)
93
+ assert_equal 200, updated[:status].to_i
94
+ assert_equal @account_master_update[:account_code], updated[:json][:account_code]
95
+ assert_equal @account_master_update[:account_name], updated[:json][:account_name]
96
+ assert_equal @account_master_update[:descid], updated[:json][:descid]
97
+ assert_equal @account_master_update[:fc_revaluation_target], updated[:json][:fc_revaluation_target]
98
+ end
99
+
100
+ def test_update_account_masters_without_fc_revaluation_target
101
+ # fc_revaluation_targetを省略した場合、既存の値が保持される
102
+ # このテストは実際のAPIレスポンスに依存するため、
103
+ # スタブではupdate_responseを使用してfc_revaluation_target: 0を返す
104
+ # 実際のAPIではfc_revaluation_targetを省略すると既存値が保持される
105
+ updated = @api.update_account_masters(@account_master_update_without_fc)
106
+ assert_equal 200, updated[:status].to_i
107
+ assert_equal @account_master_update_without_fc[:account_name], updated[:json][:account_name]
108
+ end
109
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tsubaiso-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.20
4
+ version: 1.2.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tsubaiso, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-09-11 00:00:00.000000000 Z
11
+ date: 2026-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -64,6 +64,7 @@ files:
64
64
  - test/stubbings/stub_register.rb
65
65
  - test/test_tsubaiso_api.rb
66
66
  - test/tsubaiso_sdk/common_setup_and_teardown.rb
67
+ - test/tsubaiso_sdk/test_account_masters.rb
67
68
  - test/tsubaiso_sdk/test_ap_reason_masters.rb
68
69
  - test/tsubaiso_sdk/test_ap_report.rb
69
70
  - test/tsubaiso_sdk/test_api_history.rb
@@ -117,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
- rubygems_version: 3.3.22
121
+ rubygems_version: 3.2.33
121
122
  signing_key:
122
123
  specification_version: 4
123
124
  summary: SDK for the Tsubaiso API