tsubaiso-sdk 1.2.12 → 1.2.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a0ab0090c36f342bd373de2eae64dcb501dc728cf500b4bfd7ff4c2ef2483cfb
4
- data.tar.gz: 1ae4c0635a0debc2e331f51f2a9f2369c3efd3845cddec767105d1eecb011ff2
3
+ metadata.gz: 190ada7308dbe9ef0fbd7d9245add49b5e370c8463cf28b0f5f1c66de06344f2
4
+ data.tar.gz: a801abe86bda0ebb6a6e53494cdb8b2fa8359aa42ed1772372bf6aeda51fbf99
5
5
  SHA512:
6
- metadata.gz: f0d7ca2a29d15722668a24d183f4e7147be4758f91ce04b09e20a45ca497f690c12f38a5e659b38c75bc4165a16881c65a4157d0fc9dc7c3b639244c139cfd4e
7
- data.tar.gz: 84be4f0d1ef8cec0f0b0d8b51c162d314965b2235b310ab6b7a2684370b1fac4380d07e5fbdc8da898db55fe64043350b3815d3f46b7a19f3a82e846a0fa0277
6
+ metadata.gz: a1057dca0e8b4a14ea1d3d84371e80b31bda705bc839de7c228eaa0c4fe9629095004627f28b36f1e5971b2bbb194a0f8e0d548ec490f934d163535a8bb4e7ae
7
+ data.tar.gz: 2b66206d8105661ec555975c2d84a634ab13a99e561a8543d9fd07fe9f5112d0106505c06221a73570c741e0389957bf677b1b59ca9823f28318576f4d1e218a
data/lib/tsubaiso_sdk.rb CHANGED
@@ -15,6 +15,7 @@ class TsubaisoSDK
15
15
  def initialize(options = {})
16
16
  @base_url = options[:base_url] || 'https://tsubaiso.net'
17
17
  @access_token = options[:access_token] || "Fake_Token"
18
+ @http_option = options[:http_option] || {}
18
19
  end
19
20
 
20
21
  def list_bank_account_masters
@@ -166,6 +167,14 @@ class TsubaisoSDK
166
167
  api_request(uri, 'POST', params)
167
168
  end
168
169
 
170
+ def setup_account_assignments
171
+ params = {
172
+ 'format' => 'json',
173
+ }
174
+ uri = URI.parse(@base_url + '/account_assignments/initial_setup')
175
+ api_request(uri, 'POST', params)
176
+ end
177
+
169
178
  def index_api_history
170
179
  params = { 'format' => 'json' }
171
180
  uri = URI.parse(@base_url + '/api_histories/index')
@@ -617,6 +626,7 @@ class TsubaisoSDK
617
626
  'is_valid' => options[:is_valid],
618
627
  'memo' => options[:memo],
619
628
  'account_code' => options[:account_code],
629
+ 'bank_reason_taxes' => options[:bank_reason_taxes],
620
630
  'format' => 'json'
621
631
  }
622
632
  uri = URI.parse(@base_url + '/bank_reason_masters/create')
@@ -681,6 +691,8 @@ class TsubaisoSDK
681
691
  'port_type' => options[:port_type],
682
692
  'tag_list' => options[:tag_list],
683
693
  'data_partner' => options[:data_partner],
694
+ 'scheduled_pay_method' => options[:scheduled_pay_method],
695
+ 'scheduled_pay_interface_id' => options[:scheduled_pay_interface_id],
684
696
  'format' => 'json'
685
697
  }
686
698
  uri = URI.parse(@base_url + '/ap_payments/create')
@@ -701,6 +713,8 @@ class TsubaisoSDK
701
713
  'tag_list' => options[:tag_list],
702
714
  'data_partner' => options[:data_partner],
703
715
  'key' => options[:key],
716
+ 'scheduled_pay_method' => options[:scheduled_pay_method],
717
+ 'scheduled_pay_interface_id' => options[:scheduled_pay_interface_id],
704
718
  'format' => 'json'
705
719
  }
706
720
  uri = URI.parse(@base_url + '/ap_payments/find_or_create')
@@ -746,7 +760,8 @@ class TsubaisoSDK
746
760
  'corporate_master_type' => options[:corporate_master_type],
747
761
  'email_to' => options[:email_to],
748
762
  'name' => options[:name],
749
- 'freeze_login' => options[:freeze_login]
763
+ 'freeze_login' => options[:freeze_login],
764
+ 'not_personalize_account' => options[:not_personalize_account]
750
765
  }
751
766
  uri = URI.parse(@base_url + '/corporate_masters/create')
752
767
  api_request(uri, 'POST', params)
@@ -895,7 +910,8 @@ class TsubaisoSDK
895
910
  'is_valid' => options[:is_valid],
896
911
  'memo' => options[:memo],
897
912
  'port_type' => options[:port_type],
898
- 'sort_number' => options[:sort_number]
913
+ 'sort_number' => options[:sort_number],
914
+ 'reason_taxes_onestr' => options[:reason_taxes_onestr],
899
915
  }
900
916
  uri = URI.parse(@base_url + '/petty_cash_reason_masters/create')
901
917
  api_request(uri, 'POST', params)
@@ -1008,7 +1024,8 @@ class TsubaisoSDK
1008
1024
  :dc,
1009
1025
  :is_valid,
1010
1026
  :memo,
1011
- :account_code
1027
+ :account_code,
1028
+ :bank_reason_taxes
1012
1029
  ]
1013
1030
 
1014
1031
  params = create_parameters(candidate_keys,options)
@@ -1140,7 +1157,8 @@ class TsubaisoSDK
1140
1157
  :is_valid,
1141
1158
  :memo,
1142
1159
  :port_type,
1143
- :sort_number
1160
+ :sort_number,
1161
+ :reason_taxes_onestr
1144
1162
  ]
1145
1163
  params = create_parameters(candidate_keys,options)
1146
1164
  params['format'] = 'json'
@@ -1394,17 +1412,50 @@ class TsubaisoSDK
1394
1412
  api_request(uri, 'POST', params)
1395
1413
  end
1396
1414
 
1415
+ def create_reimbursement_reason_masters(options)
1416
+ params = {
1417
+ 'format' => 'json',
1418
+ 'reason_code' => options[:reason_code],
1419
+ 'reason_name' => options[:reason_name],
1420
+ 'dc' => options[:dc],
1421
+ 'account_code' => options[:account_code],
1422
+ 'sort_number' => options[:sort_number],
1423
+ 'is_valid' => options[:is_valid],
1424
+ 'memo' => options[:memo],
1425
+ 'port_type' => options[:port_type],
1426
+ 'reimbursement_reason_taxes' => options[:reimbursement_reason_taxes],
1427
+ }
1428
+ uri = URI.parse(@base_url + '/reimbursement_reason_masters/create')
1429
+ api_request(uri, 'POST', params)
1430
+ end
1431
+
1432
+ def update_reimbursement_reason_masters(id, options)
1433
+ params = {
1434
+ 'format' => 'json',
1435
+ 'sort_number' => options[:sort_number],
1436
+ 'reason_code' => options[:reason_code],
1437
+ 'reason_name' => options[:reason_name],
1438
+ 'dc' => options[:dc],
1439
+ "account_code" => options[:account_code],
1440
+ 'is_valid' => options[:is_valid],
1441
+ 'memo' => options[:memo],
1442
+ 'port_type' => options[:port_type],
1443
+ }
1444
+ uri = URI.parse(@base_url + "/reimbursement_reason_masters/update/#{id}")
1445
+ api_request(uri, 'POST', params)
1446
+ end
1447
+
1397
1448
  def list_users
1398
1449
  params = { 'format' => 'json' }
1399
1450
  uri = URI.parse(@base_url + '/users/list')
1400
1451
  api_request(uri, 'GET', params)
1401
1452
  end
1402
1453
 
1403
- def list_depts
1404
- params = { 'format' => 'json' }
1405
- uri = URI.parse(@base_url + '/depts/list/')
1406
- api_request(uri, 'GET', params)
1407
- end
1454
+ # def list_depts
1455
+ # params = { 'format' => 'json' }
1456
+ # uri = URI.parse(@base_url + '/depts/list/')
1457
+ # api_request(uri, 'GET', params)
1458
+ # end
1408
1459
 
1409
1460
  def update_system_managements(options)
1410
1461
  params = {
@@ -1438,6 +1489,7 @@ class TsubaisoSDK
1438
1489
  'enable' => options[:enable],
1439
1490
  'name' => options[:name],
1440
1491
  'description' => options[:description],
1492
+ 'no' => options[:no]
1441
1493
  }
1442
1494
  uri = URI.parse(@base_url + '/ar_segment_masters/create')
1443
1495
  api_request(uri, 'POST', params)
@@ -1451,6 +1503,7 @@ class TsubaisoSDK
1451
1503
  'enable' => options[:enable],
1452
1504
  'name' => options[:name],
1453
1505
  'description' => options[:description],
1506
+ 'no' => options[:no],
1454
1507
  }
1455
1508
  uri = URI.parse(@base_url + '/ap_segment_masters/create')
1456
1509
  api_request(uri, 'POST', params)
@@ -1605,8 +1658,9 @@ class TsubaisoSDK
1605
1658
  api_request(uri, 'GET', params)
1606
1659
  end
1607
1660
 
1608
- def list_ap_cashflow_schedule(year, month)
1661
+ def list_ap_cashflow_schedule(year, month, options = {})
1609
1662
  params = { 'format' => 'json' }
1663
+ params['pay_method'] = options[:pay_method] if options
1610
1664
  uri = URI.parse(@base_url + "/ap_reports/list_cashflow_schedule/#{year}/#{month}")
1611
1665
  api_request(uri, 'GET', params)
1612
1666
  end
@@ -1857,6 +1911,31 @@ class TsubaisoSDK
1857
1911
  api_request(uri, 'POST', params)
1858
1912
  end
1859
1913
 
1914
+ def list_corporate_data(options)
1915
+ candidate_keys = [
1916
+ :code
1917
+ ]
1918
+ params = create_parameters(candidate_keys, options)
1919
+ uri = URI.parse(@base_url + "/corporate_data/list")
1920
+ api_request(uri, 'GET', params)
1921
+ end
1922
+
1923
+ # options: id: 会社基本情報Id, data: Base64エンコードデータ, filename: ファイル名, contenttype: Content-Type
1924
+ # id で指定した corporate_datum が存在している必要があります。
1925
+ # その corporate_datum の corporate_datum_master の input_type が 'image' である必要があります。
1926
+ # 既存の添付ファイルは削除されて差し替えられます。
1927
+ def update_attachment_to_corporate_data(options)
1928
+ candidate_keys = [
1929
+ :id,
1930
+ :data,
1931
+ :filename,
1932
+ :contenttype
1933
+ ]
1934
+ params = create_parameters(candidate_keys, options)
1935
+ uri = URI.parse(@base_url + '/corporate_data/update_attachment')
1936
+ api_request(uri, 'POST', params)
1937
+ end
1938
+
1860
1939
  private
1861
1940
 
1862
1941
 
@@ -1870,6 +1949,9 @@ class TsubaisoSDK
1870
1949
 
1871
1950
  def api_request(uri, http_verb, params)
1872
1951
  http = Net::HTTP.new(uri.host, uri.port)
1952
+ http.open_timeout = @http_option[:open_timeout] if @http_option[:open_timeout]
1953
+ http.read_timeout = @http_option[:read_timeout] if @http_option[:read_timeout]
1954
+
1873
1955
  initheader = { 'Content-Type' => 'application/json' }
1874
1956
  http.use_ssl = true if @base_url =~ /^https/
1875
1957
  if http_verb == 'GET'
@@ -0,0 +1,47 @@
1
+ require 'minitest/autorun'
2
+ require_relative './common_setup_and_teardown.rb'
3
+
4
+ class ApReportTest < Minitest::Test
5
+ include CommonSetupAndTeardown
6
+
7
+ def setup
8
+ super("ap_reports")
9
+ end
10
+
11
+ def test_list_ap_cashflow_schedule
12
+ url = @api.instance_variable_get(:@base_url) + "/ap_reports/list_cashflow_schedule/2019/12"
13
+
14
+ request_headers = {
15
+ 'Accept'=>'*/*',
16
+ 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
17
+ 'Content-Type'=>'application/json',
18
+ 'User-Agent'=>'Ruby',
19
+ "Access-Token" => @api.instance_variable_get(:@access_token)
20
+ }
21
+
22
+ req_fixture_path = "test/stubbings/fixtures/ap_reports_list_cashflow_schedule_request.json"
23
+ req_stubs = JSON.load(File.read(req_fixture_path))
24
+ req_stubs.each do |params|
25
+ params.merge!(format: 'json')
26
+ end
27
+
28
+ response_body = {}
29
+
30
+ stub_request(:get, url)
31
+ .with({ headers: request_headers }.merge({ body: req_stubs[0] }))
32
+ .to_return({ status: 200 }.merge( { body: response_body.to_json } ))
33
+
34
+ # Without pay_method option parameters
35
+ schedule_list = @api.list_ap_cashflow_schedule(2019, 12)
36
+ assert_equal 200, schedule_list[:status].to_i, schedule_list.inspect
37
+
38
+ stub_request(:get, url)
39
+ .with({ headers: request_headers }.merge({ body: req_stubs[1] }))
40
+ .to_return({ status: 200 }.merge( { body: response_body.to_json } ))
41
+
42
+ # With pay_method option parameters
43
+ schedule_list_with_opts = @api.list_ap_cashflow_schedule(2019, 12,
44
+ { :pay_method => 'BANK_FB' })
45
+ assert_equal 200, schedule_list_with_opts[:status].to_i, schedule_list_with_opts.inspect
46
+ end
47
+ end
@@ -12,7 +12,8 @@ class BankReasonMasterTest < Minitest::Test
12
12
  dc: "d",
13
13
  is_valid: 0,
14
14
  memo: "This reason has been created form API",
15
- account_code: 1
15
+ account_code: 1,
16
+ bank_reason_taxes: "免税・簡易・本則/1/3001/210"
16
17
  }
17
18
 
18
19
  @bank_reason_master_2 = {
@@ -22,7 +23,8 @@ class BankReasonMasterTest < Minitest::Test
22
23
  dc: "c",
23
24
  is_valid: 0,
24
25
  memo: "This reason has been created form API2",
25
- account_code: 1
26
+ account_code: 1,
27
+ bank_reason_taxes: "免税・簡易・本則/1/3001/210"
26
28
  }
27
29
 
28
30
  @bank_reason_master_3 = {
@@ -32,7 +34,8 @@ class BankReasonMasterTest < Minitest::Test
32
34
  dc: "d",
33
35
  is_valid: 0,
34
36
  memo: "This reason has been created form API3",
35
- account_code: 1
37
+ account_code: 1,
38
+ bank_reason_taxes: "免税・簡易・本則/1/3001/210"
36
39
  }
37
40
 
38
41
  super("bank_reason_masters")
@@ -13,7 +13,8 @@ class PettyCashReasonMaster < Minitest::Test
13
13
  is_valid: '0',
14
14
  memo: 'this is test before update',
15
15
  port_type: '0',
16
- sort_number: '0'
16
+ sort_number: '0',
17
+ reason_taxes_onestr: '免税・簡易・本則/国内/1/3001/210'
17
18
  }
18
19
 
19
20
  @petty_cash_reason_master_2 = {
@@ -24,7 +25,8 @@ class PettyCashReasonMaster < Minitest::Test
24
25
  is_valid: "0",
25
26
  memo: "This is Test reason.",
26
27
  port_type: "0",
27
- sort_number: "0"
28
+ sort_number: "0",
29
+ reason_taxes_onestr: "免税・簡易・本則/国内/1/3001/210"
28
30
  }
29
31
  super("petty_cash_reason_masters")
30
32
  end
@@ -17,7 +17,9 @@ class PurchaseTest < Minitest::Test
17
17
  memo: '',
18
18
  tax_code: 1007,
19
19
  port_type: 1,
20
- data_partner: { link_url: 'www.example.com/3', id_code: '3', partner_code: 'Example' }
20
+ data_partner: { link_url: 'www.example.com/3', id_code: '3', partner_code: 'Example' },
21
+ scheduled_pay_method: 'BANK_FB',
22
+ scheduled_pay_interface_id: 2
21
23
  }
22
24
 
23
25
  @purchase_201609 = {
@@ -83,7 +85,9 @@ class PurchaseTest < Minitest::Test
83
85
  id: purchase[:json][:id].to_i,
84
86
  price_including_tax: 50_000,
85
87
  memo: 'Updated memo',
86
- data_partner: { id_code: '300' }
88
+ data_partner: { id_code: '300' },
89
+ scheduled_pay_method: 'BANK_AUTOMATIC',
90
+ scheduled_pay_interface_id: 1
87
91
  }
88
92
 
89
93
  updated_purchase = @api.update_purchase(options)
@@ -5,18 +5,44 @@ class ReimbursementsTest < Minitest::Test
5
5
  include CommonSetupAndTeardown
6
6
 
7
7
  def setup
8
+ txhash = {}
9
+ txhash[:transaction_timestamp] = '2016-03-01'
10
+ txhash[:price_value] = 20000
11
+ txhash[:reason_code] = 'CONFERENCE_EXPENSES_SGA'
12
+ txhash[:dc] = 'd'
13
+ txhash[:brief] = '会議費'
14
+ txhash[:memo] = 'memo'
15
+ txhash[:tax_type] = '租税公課'
16
+
8
17
  @reimbursement_1 = {
9
18
  applicant: 'Irfan',
10
19
  application_term: '2016-03-01',
11
20
  staff_code: 'EP2000',
12
- memo: 'aaaaaaaa'
21
+ memo: 'aaaaaaaa',
22
+ dept_code: 'SETSURITSU',
23
+ applicant_staff_code: 'EP2001',
24
+ pay_date: '2016-02-01'
13
25
  }
14
26
 
15
27
  @reimbursement_2 = {
16
28
  applicant: 'Matsuno',
17
29
  application_term: '2016-03-01',
18
30
  staff_code: 'EP2000',
19
- memo: 'aaaaaaaa'
31
+ memo: 'aaaaaaaa',
32
+ dept_code: 'SETSURITSU',
33
+ applicant_staff_code: 'EP2001',
34
+ pay_date: '2016-02-01'
35
+ }
36
+
37
+ @reimbursement_3 = {
38
+ applicant: 'Matsuno',
39
+ application_term: '2016-03-01',
40
+ staff_code: 'EP2000',
41
+ memo: 'aaaaaaaa',
42
+ dept_code: 'SETSURITSU',
43
+ applicant_staff_code: 'EP2001',
44
+ pay_date: '2016-02-01',
45
+ transactions: txhash
20
46
  }
21
47
  super("reimbursements")
22
48
  end
@@ -61,30 +87,10 @@ class ReimbursementsTest < Minitest::Test
61
87
  end
62
88
 
63
89
  def test_create_reimbursement_and_transactions
64
- request_body = {
65
- applicant: 'Matsuno',
66
- application_term: '2016-03-01',
67
- staff_code: 'EP2000',
68
- memo: 'aaaaaaaa',
69
- pay_date: '2020-1-13',
70
- applicant_staff_code: 'test_applicant_code',
71
- transactions: [
72
- {
73
- transaction_timestamp: '2020-1-1',
74
- price_value: 1000,
75
- reason_code: 'SUPPLIES'
76
- }
77
- ]
78
- }
79
-
80
- reimbursement = @api.create_reimbursement(request)
90
+ reimbursement = @api.create_reimbursement(@reimbursement_3)
81
91
  assert_equal 200, reimbursement[:status].to_i, reimbursement.inspect
82
- assert_equal request_body[:applicant], reimbursement[:json][:applicant]
83
- assert_equal request_body[:pay_date], reimbursement[:json][:pay_date]
84
- assert_equal request_body[:applicant_staff_code], reimbursement[:json][:applicant_staff_code]
92
+ assert_equal @reimbursement_3[:applicant], reimbursement[:json][:applicant]
93
+ assert_equal @reimbursement_3[:pay_date], reimbursement[:json][:pay_date]
85
94
 
86
- reimbursement_transactions = @api.list_reimbursement_transactions(reimbursement[:json][:id])
87
- assert_equal 200, reimbursement_transactions[:status].to_i, reimbursement_transactions.inspect
88
- assert_equal 1, reimbursement_transactions[:json].size
89
95
  end
90
96
  end
@@ -75,14 +75,14 @@ class SaleTest < Minitest::Test
75
75
  assert(sales_list[:json].none? { |x| x[:id] == september_sale_id })
76
76
  end
77
77
 
78
- def test_update_sale
79
- sale = @api.create_sale(@sale_201608)
80
- options = {
81
- id: sale[:json][:id].to_i,
82
- price_including_tax: 25_000,
83
- memo: 'Updated memo',
84
- data_partner: { id_code: "100" }
85
- }
78
+ def test_update_sale
79
+ sale = @api.create_sale(@sale_201608)
80
+ options = {
81
+ id: sale[:json][:id].to_i,
82
+ price_including_tax: 25_000,
83
+ memo: 'Updated memo',
84
+ data_partner: { id_code: "100" }
85
+ }
86
86
 
87
87
  updated_sale = @api.update_sale(options)
88
88
  assert_equal 200, updated_sale[:status].to_i, updated_sale[:json]
@@ -58,14 +58,14 @@ class StaffDataTest < Minitest::Test
58
58
  end
59
59
 
60
60
  def test_update_staff_data
61
+ staff_id = 0
61
62
  options = {
62
- staff_id: 0,
63
63
  value: 'Programmer'
64
64
  }
65
65
 
66
- updated_staff_data = @api.update_staff_data(options)
66
+ updated_staff_data = @api.update_staff_data(staff_id,options)
67
67
  assert_equal 200, updated_staff_data[:status].to_i, updated_staff_data.inspect
68
- assert_equal options[:staff_id], updated_staff_data[:json][:id].to_i
68
+ assert_equal staff_id, updated_staff_data[:json][:id].to_i
69
69
  assert_equal 'Programmer', updated_staff_data[:json][:value]
70
70
  end
71
71
  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.12
4
+ version: 1.2.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tsubaiso, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-28 00:00:00.000000000 Z
11
+ date: 2022-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -65,6 +65,7 @@ files:
65
65
  - test/test_tsubaiso_api.rb
66
66
  - test/tsubaiso_sdk/common_setup_and_teardown.rb
67
67
  - test/tsubaiso_sdk/test_ap_reason_masters.rb
68
+ - test/tsubaiso_sdk/test_ap_report.rb
68
69
  - test/tsubaiso_sdk/test_api_history.rb
69
70
  - test/tsubaiso_sdk/test_ar_reason_masters.rb
70
71
  - test/tsubaiso_sdk/test_bank_account.rb
@@ -115,7 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  - !ruby/object:Gem::Version
116
117
  version: '0'
117
118
  requirements: []
118
- rubygems_version: 3.0.3
119
+ rubygems_version: 3.3.26
119
120
  signing_key:
120
121
  specification_version: 4
121
122
  summary: SDK for the Tsubaiso API