tsubaiso-sdk 1.2.7 → 1.2.11

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: 394ff46b866be9b88b3f3240d749d5981ae40c659f08c388adc763908f15b861
4
- data.tar.gz: caa5951cfbc2dbcb16a72f240e5ebdfb3f70151eb7b763bb2c52a158fa72200d
3
+ metadata.gz: 1be2b8de64e9cb4337cdbb2a282a463222e0f8b0bdd5bb37e3574cd9c9bb83c2
4
+ data.tar.gz: 382c33d6ce383694d7a431c0b9cda89f5a7ef781add64a9a8e6fc0b0fc1bdf30
5
5
  SHA512:
6
- metadata.gz: 7681bd9b474bf300e774b8d4594dd99580924af1563e8bafe2e605503023f8f66b87aaf976bf3539038240c74e67b817466e6eafb87127e603d2cb7a638d5a92
7
- data.tar.gz: 8f8b1b847e9e876a5be43ea21826bd72144c26c4b2a45d67d732fd25a7d3d373129e20e1ea9120a762451f1fdf6bd53b40f765444420ae5f9b52462adb05ea88
6
+ metadata.gz: 9ad39f6a3293571ed92e0d9d849e82b0b2c82b29db33e5af1c02c69ac2a3f43a3d62febedfd03ec8b6270deba53cf3d73641a53bdbd92678d37283edcfee5005
7
+ data.tar.gz: d57e571877d810e4050ed2cf7e613cc1803d1e905c1e48fe11623ffa755c917e3fffddfec3cd158950ebc4c6f2a8e8719e509309d35447256731027f666d4a50
data/lib/tsubaiso_sdk.rb CHANGED
@@ -317,6 +317,12 @@ class TsubaisoSDK
317
317
  api_request(uri, 'GET', params)
318
318
  end
319
319
 
320
+ def list_tag_groups
321
+ params = { 'format' => 'json' }
322
+ uri = URI.parse(@base_url + '/tag_groups/index')
323
+ api_request(uri, 'GET', params)
324
+ end
325
+
320
326
  def list_bonuses(bonus_no, target_year)
321
327
  params = {
322
328
  'format' => 'json',
@@ -590,7 +596,9 @@ class TsubaisoSDK
590
596
  'zip',
591
597
  'pay_date_if_holiday',
592
598
  'receive_date_if_holiday',
593
- 'data_partner'
599
+ 'data_partner',
600
+ 'corporate_mynumber',
601
+ 'pay_method',
594
602
  ]
595
603
  params = {}
596
604
  params = create_parameters(available_keys.map{|x| x.to_sym},options)
@@ -731,6 +739,67 @@ class TsubaisoSDK
731
739
  api_request(uri, 'POST', params)
732
740
  end
733
741
 
742
+ def create_corp(options)
743
+ params = {
744
+ 'format' => 'json',
745
+ 'stage' => options[:stage],
746
+ 'corporate_master_type' => options[:corporate_master_type],
747
+ 'email_to' => options[:email_to],
748
+ 'name' => options[:name],
749
+ 'freeze_login' => options[:freeze_login]
750
+ }
751
+ uri = URI.parse(@base_url + '/corporate_masters/create')
752
+ api_request(uri, 'POST', params)
753
+ end
754
+
755
+ def create_user(options)
756
+ params = {
757
+ 'format' => 'json'
758
+ }
759
+ uri = URI.parse(@base_url + '/users/create')
760
+ api_request(uri, 'POST', params)
761
+ end
762
+
763
+ def update_user(options)
764
+ params = {
765
+ 'format' => 'json',
766
+ 'id' => options[:id],
767
+ 'email' => options[:email],
768
+ 'firstname' => options[:firstname],
769
+ 'lastname' => options[:lastname],
770
+ 'permitted_address' => options[:permitted_address],
771
+ 'dept_codes' => options[:dept_codes],
772
+ 'lang' => options[:lang],
773
+ 'inuse' => options[:inuse],
774
+ }
775
+ uri = URI.parse(@base_url + '/users/update')
776
+ api_request(uri, 'POST', params)
777
+ end
778
+
779
+ def add_domains(options)
780
+ params = {
781
+ 'format' => 'json',
782
+ 'id' => options[:id],
783
+ 'domains' => options[:domains]
784
+ }
785
+ uri = URI.parse(@base_url + '/users/add_domains')
786
+ api_request(uri, 'POST', params)
787
+ end
788
+
789
+ def create_fiscal_master(options)
790
+ params = {
791
+ 'format' => 'json',
792
+ 'term' => options[:term],
793
+ 'start_timestamp' => options[:start_timestamp],
794
+ 'finish_timestamp' => options[:finish_timestamp],
795
+ 'launch_timestamp' => options[:launch_timestamp],
796
+ 'status' => options[:status],
797
+ 'sales_tax_system' => options[:sales_tax_system]
798
+ }
799
+ uri = URI.parse(@base_url + '/fiscal_masters/create')
800
+ api_request(uri, 'POST', params)
801
+ end
802
+
734
803
  def create_reimbursement(options)
735
804
  params = {
736
805
  'format' => 'json',
@@ -738,7 +807,10 @@ class TsubaisoSDK
738
807
  'application_term' => options[:application_term],
739
808
  'staff_code' => options[:staff_code],
740
809
  'dept_code' => options[:dept_code],
741
- 'memo' => options[:memo]
810
+ 'memo' => options[:memo],
811
+ 'applicant_staff_code' => options[:applicant_staff_code],
812
+ 'transactions' => options[:transactions],
813
+ 'pay_date' => options[:pay_date]
742
814
  }
743
815
  uri = URI.parse(@base_url + '/reimbursements/create')
744
816
  api_request(uri, 'POST', params)
@@ -945,8 +1017,9 @@ class TsubaisoSDK
945
1017
  api_request(uri, "POST",params)
946
1018
  end
947
1019
 
948
- def update_staff_data(options)
1020
+ def update_staff_data(staff_data_id, options)
949
1021
  params = {
1022
+ 'code' => options[:code],
950
1023
  'memo' => options[:memo],
951
1024
  'value' => options[:value],
952
1025
  'start_timestamp' => options[:start_timestamp],
@@ -959,7 +1032,7 @@ class TsubaisoSDK
959
1032
  params[:no_finish_timestamp] = options[:no_finish_timestamp]
960
1033
  end
961
1034
 
962
- uri = URI.parse(@base_url + "/staff_data/update/#{options[:staff_id]}")
1035
+ uri = URI.parse(@base_url + "/staff_data/update/#{staff_data_id}")
963
1036
  api_request(uri, 'POST', params)
964
1037
  end
965
1038
 
@@ -1045,6 +1118,18 @@ class TsubaisoSDK
1045
1118
  api_request(uri, 'POST', params)
1046
1119
  end
1047
1120
 
1121
+ def update_tag_group(tag_group_id, options)
1122
+ params = {}
1123
+ candidate_keys = [
1124
+ :code,
1125
+ :name
1126
+ ]
1127
+ params = create_parameters(candidate_keys,options)
1128
+ params['format'] = 'json'
1129
+ uri = URI.parse(@base_url + "/tag_groups/update/#{tag_group_id}")
1130
+ api_request(uri, 'POST', params)
1131
+ end
1132
+
1048
1133
  def update_petty_cash_reason_master(petty_cash_reason_master_id, options)
1049
1134
  params = {}
1050
1135
  candidate_keys = [
@@ -1174,6 +1259,565 @@ class TsubaisoSDK
1174
1259
  api_request(uri, 'GET', params)
1175
1260
  end
1176
1261
 
1262
+ def create_account_masters(options)
1263
+ candidate_keys = [
1264
+ :account_code,
1265
+ :account_name,
1266
+ :descid,
1267
+ :account_kana,
1268
+ :dc,
1269
+ :bspl,
1270
+ :sum_no,
1271
+ :brief,
1272
+ :inputtable,
1273
+ :use_in_balance,
1274
+ :status,
1275
+ ]
1276
+ params = create_parameters(candidate_keys,options)
1277
+ uri = URI.parse(@base_url + '/account_masters/create')
1278
+ api_request(uri, 'POST', params)
1279
+ end
1280
+
1281
+ def update_account_masters(options)
1282
+ candidate_keys = [
1283
+ :id,
1284
+ :account_code,
1285
+ :account_name,
1286
+ :account_kana,
1287
+ :descid,
1288
+ :brief,
1289
+ :sum_no,
1290
+ :dc,
1291
+ :bspl,
1292
+ :inputtable,
1293
+ :use_in_balance,
1294
+ :status,
1295
+ ]
1296
+ params = create_parameters(candidate_keys,options)
1297
+ uri = URI.parse(@base_url + '/account_masters/update')
1298
+ api_request(uri, 'POST', params)
1299
+ end
1300
+
1301
+ def list_account_masters
1302
+ params = {
1303
+ 'format' => 'json',
1304
+ }
1305
+ uri = URI.parse(@base_url + "/account_masters/list")
1306
+ api_request(uri, 'GET', params)
1307
+ end
1308
+
1309
+ def create_corporate_data(options)
1310
+ params = {
1311
+ 'format' => 'json',
1312
+ 'code' => options[:code],
1313
+ 'start_timestamp' => options[:start_timestamp],
1314
+ 'finish_timestamp' => options[:finish_timestamp],
1315
+ 'value' => options[:value],
1316
+ 'memo' => options[:memo]
1317
+ }
1318
+ uri = URI.parse(@base_url + '/corporate_data/create')
1319
+ api_request(uri, 'POST', params)
1320
+ end
1321
+
1322
+ def create_petty_cash_masters(options)
1323
+ params = {
1324
+ 'format' => 'json',
1325
+ 'name' => options[:name],
1326
+ 'start_ymd' => options[:start_ymd],
1327
+ 'finish_ymd' => options[:finish_ymd],
1328
+ 'memo' => options[:memo],
1329
+ }
1330
+ uri = URI.parse(@base_url + '/petty_cash_masters/create')
1331
+ api_request(uri, 'POST', params)
1332
+ end
1333
+
1334
+ def create_ar_reason_masters(options)
1335
+ params = {
1336
+ 'format' => 'json',
1337
+ 'reason_code' => options[:reason_code],
1338
+ 'reason_name' => options[:reason_name],
1339
+ 'dc' => options[:dc],
1340
+ 'account_code' => options[:account_code],
1341
+ 'sort_number' => options[:sort_number],
1342
+ 'is_valid' => options[:is_valid],
1343
+ 'memo' => options[:memo],
1344
+ 'ar_reason_taxes' => options[:ar_reason_taxes],
1345
+ }
1346
+ uri = URI.parse(@base_url + '/ar_reason_masters/create')
1347
+ api_request(uri, 'POST', params)
1348
+ end
1349
+
1350
+ def update_ar_reason_masters(id, options)
1351
+ params = {
1352
+ 'format' => 'json',
1353
+ 'reason_code' => options[:reason_code],
1354
+ 'reason_name' => options[:reason_name],
1355
+ 'dc' => options[:dc],
1356
+ 'sort_number' => options[:sort_number],
1357
+ 'is_valid' => options[:is_valid],
1358
+ 'memo' => options[:memo],
1359
+ 'ar_reason_taxes' => options[:ar_reason_taxes],
1360
+ }
1361
+ uri = URI.parse(@base_url + "/ar_reason_masters/update/#{id}")
1362
+ api_request(uri, 'POST', params)
1363
+ end
1364
+
1365
+ def create_ap_reason_masters(options)
1366
+ params = {
1367
+ 'format' => 'json',
1368
+ 'reason_code' => options[:reason_code],
1369
+ 'reason_name' => options[:reason_name],
1370
+ 'dc' => options[:dc],
1371
+ 'account_code' => options[:account_code],
1372
+ 'sort_number' => options[:sort_number],
1373
+ 'is_valid' => options[:is_valid],
1374
+ 'memo' => options[:memo],
1375
+ 'port_type' => options[:port_type],
1376
+ 'ap_reason_taxes' => options[:ap_reason_taxes],
1377
+ }
1378
+ uri = URI.parse(@base_url + '/ap_reason_masters/create')
1379
+ api_request(uri, 'POST', params)
1380
+ end
1381
+
1382
+ def update_ap_reason_masters(id, options)
1383
+ params = {
1384
+ 'format' => 'json',
1385
+ 'reason_code' => options[:reason_code],
1386
+ 'reason_name' => options[:reason_name],
1387
+ 'dc' => options[:dc],
1388
+ 'port_type' => options[:port_type],
1389
+ 'sort_number' => options[:sort_number],
1390
+ 'is_valid' => options[:is_valid],
1391
+ 'memo' => options[:memo],
1392
+ }
1393
+ uri = URI.parse(@base_url + "/ap_reason_masters/update/#{id}")
1394
+ api_request(uri, 'POST', params)
1395
+ end
1396
+
1397
+ def list_users
1398
+ params = { 'format' => 'json' }
1399
+ uri = URI.parse(@base_url + '/users/list')
1400
+ api_request(uri, 'GET', params)
1401
+ end
1402
+
1403
+ def list_depts
1404
+ params = { 'format' => 'json' }
1405
+ uri = URI.parse(@base_url + '/depts/list/')
1406
+ api_request(uri, 'GET', params)
1407
+ end
1408
+
1409
+ def update_system_managements(options)
1410
+ params = {
1411
+ 'format' => 'json',
1412
+ 'code' => options[:code],
1413
+ 'enable' => options[:enable],
1414
+ }
1415
+ uri = URI.parse(@base_url + '/system_managements/update')
1416
+ api_request(uri, 'POST', params)
1417
+ end
1418
+
1419
+ def create_tags(options)
1420
+ params = {
1421
+ 'format' => 'json',
1422
+ 'code' => options[:code],
1423
+ 'name' => options[:name],
1424
+ 'sort_no' => options[:sort_no],
1425
+ 'tag_group_code' => options[:tag_group_code],
1426
+ 'start_ymd' => options[:start_ymd],
1427
+ 'finish_ymd' => options[:finish_ymd],
1428
+ }
1429
+ uri = URI.parse(@base_url + '/tags/create')
1430
+ api_request(uri, 'POST', params)
1431
+ end
1432
+
1433
+ def create_ar_segment_masters(options)
1434
+ params = {
1435
+ 'format' => 'json',
1436
+ 'account_descid' => options[:account_descid],
1437
+ 'priority_order' => options[:priority_order],
1438
+ 'enable' => options[:enable],
1439
+ 'name' => options[:name],
1440
+ 'description' => options[:description],
1441
+ }
1442
+ uri = URI.parse(@base_url + '/ar_segment_masters/create')
1443
+ api_request(uri, 'POST', params)
1444
+ end
1445
+
1446
+ def create_ap_segment_masters(options)
1447
+ params = {
1448
+ 'format' => 'json',
1449
+ 'account_descid' => options[:account_descid],
1450
+ 'priority_order' => options[:priority_order],
1451
+ 'enable' => options[:enable],
1452
+ 'name' => options[:name],
1453
+ 'description' => options[:description],
1454
+ }
1455
+ uri = URI.parse(@base_url + '/ap_segment_masters/create')
1456
+ api_request(uri, 'POST', params)
1457
+ end
1458
+
1459
+ def list_fiscal_masters
1460
+ params = {
1461
+ 'format' => 'json',
1462
+ }
1463
+ uri = URI.parse(@base_url + "/fiscal_masters/list")
1464
+ api_request(uri, 'GET', params)
1465
+ end
1466
+
1467
+ def list_balance_plan_masters
1468
+ params = {
1469
+ 'format' => 'json',
1470
+ }
1471
+ uri = URI.parse(@base_url + "/balance_plan_masters/list")
1472
+ api_request(uri, 'GET', params)
1473
+ end
1474
+
1475
+ def create_balance_plan_masters(options)
1476
+ params = {
1477
+ 'format' => 'json',
1478
+ 'code' => options[:code],
1479
+ 'name' => options[:name],
1480
+ 'memo' => options[:memo],
1481
+ 'start_ymd' => options[:start_ymd],
1482
+ 'finish_ymd' => options[:finish_ymd],
1483
+ 'in_use' => options[:in_use],
1484
+ 'is_default' => options[:is_default],
1485
+ }
1486
+ uri = URI.parse(@base_url + '/balance_plan_masters/create')
1487
+ api_request(uri, 'POST', params)
1488
+ end
1489
+
1490
+ def update_staffs(id, options)
1491
+ candidate_keys = [
1492
+ :code,
1493
+ :status,
1494
+ :dept_codes,
1495
+ ]
1496
+ params = create_parameters(candidate_keys,options)
1497
+ uri = URI.parse(@base_url + "/staffs/update/#{id}")
1498
+ api_request(uri, 'POST', params)
1499
+ end
1500
+
1501
+ def create_personalized_asset_type_masters(options)
1502
+ candidate_keys = [
1503
+ :code,
1504
+ :name,
1505
+ :asset_account_code,
1506
+ :contra_account_code,
1507
+ :contra_mc_account_code,
1508
+ :impairment_account_code,
1509
+ :impairment_mc_account_code,
1510
+ :accumulated_depreciation_account_code,
1511
+ :local_tax_segment_code,
1512
+ :corporate_tax_segment_name,
1513
+ :sort_no
1514
+ ]
1515
+ params = create_parameters(candidate_keys, options)
1516
+ uri = URI.parse(@base_url + '/personalized_asset_type_masters/create')
1517
+ api_request(uri, 'POST', params)
1518
+ end
1519
+
1520
+ def bulk_create_or_update_balance_plans(options)
1521
+ candidate_keys = [
1522
+ :balance_plans
1523
+ ]
1524
+ params = create_parameters(candidate_keys, options)
1525
+ uri = URI.parse(@base_url + '/balance_plans/bulk_create_or_update')
1526
+ api_request(uri, 'POST', params)
1527
+ end
1528
+
1529
+ def list_petty_cash_masters
1530
+ params = { 'format' => 'json' }
1531
+ uri = URI.parse(@base_url + '/petty_cash_masters/list')
1532
+ api_request(uri, 'GET', params)
1533
+ end
1534
+
1535
+ def create_petty_cashes(options)
1536
+ candidate_keys = [
1537
+ :petty_cash_master_id,
1538
+ :start_ymd,
1539
+ :finish_ymd,
1540
+ :start_balance_fixed,
1541
+ ]
1542
+ params = create_parameters(candidate_keys, options)
1543
+ uri = URI.parse(@base_url + '/petty_cashes/create')
1544
+ api_request(uri, 'POST', params)
1545
+ end
1546
+
1547
+ def create_petty_cash_transactions(options)
1548
+ candidate_keys = [
1549
+ :petty_cash_id,
1550
+ :journal_timestamp,
1551
+ :price_value,
1552
+ :reason_code,
1553
+ :dc,
1554
+ :tax_type,
1555
+ :brief,
1556
+ :memo,
1557
+ :tag_list,
1558
+ :dept_code,
1559
+ ]
1560
+ params = create_parameters(candidate_keys, options)
1561
+ uri = URI.parse(@base_url + '/petty_cash_transactions/create')
1562
+ api_request(uri, 'POST', params)
1563
+ end
1564
+
1565
+ def list_ar_reconciliations(year, month)
1566
+ params = { 'format' => 'json' }
1567
+ uri = URI.parse(@base_url + "/ar_reconciliations/list/#{year}/#{month}")
1568
+ api_request(uri, 'GET', params)
1569
+ end
1570
+
1571
+ def reconcile_ar_reconciliations(options)
1572
+ candidate_keys = [
1573
+ :reconciliation_id, # (BankAccount Transaction / PettyCash Transaction / Reimbursement Transaction) JournalDc ID.
1574
+ :reconcile_transactions
1575
+ ]
1576
+ params = create_parameters(candidate_keys, options)
1577
+ uri = URI.parse(@base_url + "/ar_reconciliations/reconcile")
1578
+ api_request(uri, 'POST', params)
1579
+ end
1580
+
1581
+ def reconcile_ap_reconciliations(options)
1582
+ candidate_keys = [
1583
+ :reconciliation_id, # (BankAccount Transaction / PettyCash Transaction / Reimbursement Transaction) JournalDc ID.
1584
+ :reconcile_transactions
1585
+ ]
1586
+ params = create_parameters(candidate_keys, options)
1587
+ uri = URI.parse(@base_url + "/ap_reconciliations/reconcile")
1588
+ api_request(uri, 'POST', params)
1589
+ end
1590
+
1591
+ # @param [String] arap 'ar' または 'ap'
1592
+ def search_customer_masters_by_reconcile_keyword(keyword, arap)
1593
+ params = {
1594
+ 'format' => 'json',
1595
+ 'keyword' => keyword,
1596
+ 'arap' => arap,
1597
+ }
1598
+ uri = URI.parse(@base_url + "/customer_masters/search_by_reconcile_keyword")
1599
+ api_request(uri, 'GET', params)
1600
+ end
1601
+
1602
+ def list_ar_cashflow_schedule(year, month)
1603
+ params = { 'format' => 'json' }
1604
+ uri = URI.parse(@base_url + "/ar_reports/list_cashflow_schedule/#{year}/#{month}")
1605
+ api_request(uri, 'GET', params)
1606
+ end
1607
+
1608
+ def list_ap_cashflow_schedule(year, month)
1609
+ params = { 'format' => 'json' }
1610
+ uri = URI.parse(@base_url + "/ap_reports/list_cashflow_schedule/#{year}/#{month}")
1611
+ api_request(uri, 'GET', params)
1612
+ end
1613
+
1614
+ def standardize_payroll_column_masters(year, month)
1615
+ params = {
1616
+ 'format' => 'json',
1617
+ 'year' => year,
1618
+ 'month' => month,
1619
+ }
1620
+ uri = URI.parse(@base_url + "/payroll_column_masters/standardize")
1621
+ api_request(uri, 'POST', params)
1622
+ end
1623
+
1624
+ def show_payroll_column_masters(year, month)
1625
+ params = {
1626
+ 'format' => 'json',
1627
+ 'year' => year,
1628
+ 'month' => month,
1629
+ }
1630
+ uri = URI.parse(@base_url + "/payroll_column_masters/show")
1631
+ api_request(uri, 'GET', params)
1632
+ end
1633
+
1634
+ def update_payrolls(options)
1635
+ candidate_keys = [
1636
+ :year,
1637
+ :month,
1638
+ :only_save,
1639
+ :update_journal,
1640
+ :staffs
1641
+ ]
1642
+ params = create_parameters(candidate_keys, options)
1643
+ uri = URI.parse(@base_url + "/payrolls/update")
1644
+ api_request(uri, 'POST', params)
1645
+ end
1646
+
1647
+ def list_ap_reconciliations(year, month)
1648
+ params = { 'format' => 'json' }
1649
+ uri = URI.parse(@base_url + "/ap_reconciliations/list/#{year}/#{month}")
1650
+ api_request(uri, 'GET', params)
1651
+ end
1652
+
1653
+ # find_or_create Adjusts
1654
+ def index_adjusts(options)
1655
+ candidate_keys = [
1656
+ :term,
1657
+ :dept_code,
1658
+ :year,
1659
+ :month
1660
+ ]
1661
+ params = create_parameters(candidate_keys, options)
1662
+ uri = URI.parse(@base_url + "/adjusts")
1663
+ api_request(uri, 'GET', params)
1664
+ end
1665
+
1666
+ def update_boy_adjusts(options)
1667
+ candidate_keys = [
1668
+ :term,
1669
+ :dept_code,
1670
+ :fixed_balances
1671
+ ]
1672
+ params = create_parameters(candidate_keys, options)
1673
+ uri = URI.parse(@base_url + "/adjusts/update_boy")
1674
+ api_request(uri, 'POST', params)
1675
+ end
1676
+
1677
+ def brought_forward_adjusts(options)
1678
+ candidate_keys = [
1679
+ :term,
1680
+ :dept_code,
1681
+ :calc_common
1682
+ ]
1683
+ params = create_parameters(candidate_keys, options)
1684
+ uri = URI.parse(@base_url + "/adjusts/brought_forward")
1685
+ api_request(uri, 'POST', params)
1686
+ end
1687
+
1688
+ def update_bank_adjusts(options)
1689
+ candidate_keys = [
1690
+ :bank_term_balances
1691
+ ]
1692
+ params = create_parameters(candidate_keys, options)
1693
+ uri = URI.parse(@base_url + "/adjusts/update_bank")
1694
+ api_request(uri, 'POST', params)
1695
+ end
1696
+
1697
+ def create_fixed_assets(options)
1698
+ candidate_keys = [
1699
+ :acquire_method,
1700
+ :acquire_source_journal_dc_id,
1701
+ :acquire_ymd,
1702
+ :asset_type_master_id,
1703
+ :brief,
1704
+ :code,
1705
+ :depreciation_entry_method,
1706
+ :depreciation_method,
1707
+ :dept_code,
1708
+ :durable_years,
1709
+ :ignore_immediate_depreciation_limit,
1710
+ :initial_depreciated_amount,
1711
+ :installed_place,
1712
+ :is_product_cost,
1713
+ :name,
1714
+ :quantity,
1715
+ :start_ymd,
1716
+ :tag_list,
1717
+ :target_ym,
1718
+ :amount_inclusive,
1719
+ :tax_code
1720
+ ]
1721
+ params = create_parameters(candidate_keys, options)
1722
+ uri = URI.parse(@base_url + "/fixed_assets/create")
1723
+ api_request(uri, 'POST', params)
1724
+ end
1725
+
1726
+ def list_personalized_asset_type_masters
1727
+ params = { 'format' => 'json' }
1728
+ uri = URI.parse(@base_url + '/personalized_asset_type_masters/list')
1729
+ api_request(uri, 'GET', params)
1730
+ end
1731
+
1732
+ def update_journals_payrolls(options)
1733
+ candidate_keys = [
1734
+ :year,
1735
+ :month
1736
+ ]
1737
+ params = create_parameters(candidate_keys, options)
1738
+ uri = URI.parse(@base_url + "/payrolls/update_journals")
1739
+ api_request(uri, 'POST', params)
1740
+ end
1741
+
1742
+ def calc_balances_queues(options)
1743
+ candidate_keys = [
1744
+ :dept_code,
1745
+ :account_code,
1746
+ :ym_from,
1747
+ :ym_until
1748
+ ]
1749
+ params = create_parameters(candidate_keys, options)
1750
+ uri = URI.parse(@base_url + "/balances/calc_queues")
1751
+ api_request(uri, 'POST', params)
1752
+ end
1753
+
1754
+ def default_fixed_assets_revaluations(id)
1755
+ params = { 'format' => 'json' }
1756
+ uri = URI.parse(@base_url + "/fixed_assets/default_revaluations/#{id}")
1757
+ api_request(uri, 'GET', params)
1758
+ end
1759
+
1760
+ def create_fixed_assets_revaluations(options)
1761
+ candidate_keys = [
1762
+ :id,
1763
+ :asset_revaluations
1764
+ ]
1765
+ params = create_parameters(candidate_keys, options)
1766
+ uri = URI.parse(@base_url + "/fixed_assets/create_revaluations")
1767
+ api_request(uri, 'POST', params)
1768
+ end
1769
+
1770
+ def create_fixed_assets_journal(options)
1771
+ candidate_keys = [
1772
+ :id,
1773
+ :year,
1774
+ :month
1775
+ ]
1776
+ params = create_parameters(candidate_keys, options)
1777
+ uri = URI.parse(@base_url + "/fixed_assets/create_journal")
1778
+ api_request(uri, 'POST', params)
1779
+ end
1780
+
1781
+ def list_payroll_attendances(year, month)
1782
+ params = { 'format' => 'json' }
1783
+ uri = URI.parse(@base_url + "/payroll_attendances/list/#{year.to_i}/#{month.to_i}")
1784
+ api_request(uri, 'GET', params)
1785
+ end
1786
+
1787
+ def list_timecards(year, month)
1788
+ params = { 'format' => 'json' }
1789
+ uri = URI.parse(@base_url + "/timecards/list/#{year.to_i}/#{month.to_i}")
1790
+ api_request(uri, 'GET', params)
1791
+ end
1792
+
1793
+ def create_timecard(options)
1794
+ candidate_keys = [
1795
+ :staff_id,
1796
+ :target_ymd,
1797
+ :punch_time_0,
1798
+ :punch_time_1,
1799
+ :punch_time_2,
1800
+ :punch_time_3,
1801
+ :additional_memo,
1802
+ ]
1803
+ params = create_parameters(candidate_keys, options)
1804
+ uri = URI.parse(@base_url + "/timecards/create")
1805
+ api_request(uri, 'POST', params)
1806
+ end
1807
+
1808
+ def update_timecard(options)
1809
+ candidate_keys = [
1810
+ :punch_time_0,
1811
+ :punch_time_1,
1812
+ :punch_time_2,
1813
+ :punch_time_3,
1814
+ :additional_memo,
1815
+ ]
1816
+ params = create_parameters(candidate_keys, options)
1817
+ uri = URI.parse(@base_url + "/timecards/update/#{options[:id]}")
1818
+ api_request(uri, 'POST', params)
1819
+ end
1820
+
1177
1821
  private
1178
1822
 
1179
1823
 
@@ -1197,14 +1841,17 @@ class TsubaisoSDK
1197
1841
  request['Access-Token'] = @access_token
1198
1842
  request.body = params.to_json
1199
1843
  response = http.request(request)
1200
- if response.body
1844
+ if response.body && !response.body.empty?
1201
1845
  begin
1202
1846
  { :status => response.code, :json => recursive_symbolize_keys(JSON.parse(response.body)) }
1203
1847
  rescue
1848
+ puts "rescue"
1849
+ puts "response.code:#{response.code}"
1850
+ puts "response.body:#{response.body}"
1204
1851
  response.body
1205
1852
  end
1206
1853
  else
1207
- response.code
1854
+ { :status => response.code }
1208
1855
  end
1209
1856
  end
1210
1857
 
@@ -164,6 +164,10 @@ class StubRegister
164
164
  stub_requests(:get, url(@root_url, resource, 'list'), {'records': @created_records}, { 'start_date': '2019-12-01', 'finish_date': '2019-12-31'} )
165
165
  stub_requests(:get, url(@root_url, resource, 'list'), {'records': @created_records}, { 'price_min': 10800, 'price_max': 10800} )
166
166
  stub_requests(:get, url(@root_url, resource, 'list'), {'records': @created_records}, { 'dept_code': 'SETSURITSU' } )
167
+ when 'payroll_attendances'
168
+ stub_requests(:get, url(@root_url, resource, 'list', 2020, 1), @created_records)
169
+ when 'timecards'
170
+ stub_requests(:get, url(@root_url, resource, 'list', 2020, 1), @created_records)
167
171
  else
168
172
  stub_requests(:get, url(@root_url, resource, 'list'), @created_records)
169
173
  end
@@ -0,0 +1,18 @@
1
+ require 'minitest/autorun'
2
+ require_relative './common_setup_and_teardown.rb'
3
+
4
+ class PayrollAttendancesTest < Minitest::Test
5
+ include CommonSetupAndTeardown
6
+
7
+ def setup
8
+ super("payroll_attendances")
9
+ end
10
+
11
+ def test_list_payroll_attendances
12
+ listed_timecards = @api.list_payroll_attendances(2020, 1)
13
+ assert_equal 200, listed_timecards[:status].to_i, listed_timecards.inspect
14
+
15
+ # 戻り値が配列でないので、list_responce のスタブを作れません。
16
+ end
17
+
18
+ end
@@ -60,4 +60,31 @@ class ReimbursementsTest < Minitest::Test
60
60
  assert_equal @reimbursement_1[:applicant], reimbursement[:json][:applicant]
61
61
  end
62
62
 
63
+ 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)
81
+ 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]
85
+
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
+ end
63
90
  end
@@ -0,0 +1,69 @@
1
+ require 'minitest/autorun'
2
+ require_relative './common_setup_and_teardown.rb'
3
+
4
+ class TimecardsTest < Minitest::Test
5
+ include CommonSetupAndTeardown
6
+
7
+ def setup
8
+ @timecards_1 = {
9
+ staff_id: 2010,
10
+ target_ymd: '2020/01/15',
11
+ punch_time_0: '09:00',
12
+ punch_time_1: '12:30',
13
+ punch_time_2: '13:45',
14
+ punch_time_3: '17:20',
15
+ additional_memo: 'タイムカード1',
16
+ }
17
+
18
+ @timecards_2 = {
19
+ staff_id: 2010,
20
+ target_ymd: '2020/01/16',
21
+ punch_time_0: '09:05',
22
+ punch_time_3: '17:25',
23
+ additional_memo: 'タイムカード2',
24
+ }
25
+
26
+ super("timecards")
27
+ end
28
+
29
+ def test_create_timecard
30
+ created_timecard = @api.create_timecard(@timecards_1)
31
+
32
+ assert_equal 200, created_timecard[:status].to_i, created_timecard.inspect
33
+ assert_equal @timecards_1[:staff_id], created_timecard[:json][:staff_id]
34
+ assert_equal @timecards_1[:target_ymd], created_timecard[:json][:target_ymd]
35
+ assert_equal @timecards_1[:punch_time_0], created_timecard[:json][:punch_time_0]
36
+ assert_equal @timecards_1[:punch_time_1], created_timecard[:json][:punch_time_1]
37
+ assert_equal @timecards_1[:punch_time_2], created_timecard[:json][:punch_time_2]
38
+ assert_equal @timecards_1[:punch_time_3], created_timecard[:json][:punch_time_3]
39
+ assert_equal 'タイムカード1[22-01-21 13:30:46 (山川 太郎)', created_timecard[:json][:memo]
40
+ end
41
+
42
+ def test_list_timecards
43
+ tc1 = @api.create_timecard(@timecards_1)
44
+ tc2 = @api.create_timecard(@timecards_2)
45
+
46
+ listed_timecards = @api.list_timecards(2020, 1)
47
+ assert_equal 200, listed_timecards[:status].to_i, listed_timecards.inspect
48
+ target_timecard = listed_timecards[:json].find{ |tc| tc[:id] == tc1[:json][:id]}
49
+ assert_equal @timecards_1[:punch_time_0], target_timecard[:punch_time_0]
50
+ end
51
+
52
+ def test_update_timecard
53
+ created_timecard = @api.create_timecard(@timecards_1)
54
+ assert_equal 200, created_timecard[:status].to_i
55
+ assert_equal "0", created_timecard[:json][:id]
56
+
57
+ updating_options = {
58
+ id: created_timecard[:json][:id],
59
+ punch_time_0: "09:01",
60
+ punch_time_1: "12:31",
61
+ punch_time_2: "13:46",
62
+ punch_time_3: "17:21",
63
+ additional_memo: "修正しました。",
64
+ }
65
+
66
+ updated_timecard = @api.update_timecard(updating_options)
67
+ assert_equal 200, updated_timecard[:status].to_i
68
+ end
69
+ 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.7
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tsubaiso, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-11 00:00:00.000000000 Z
11
+ date: 2022-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -72,7 +72,6 @@ files:
72
72
  - test/tsubaiso_sdk/test_bank_account_transaction.rb
73
73
  - test/tsubaiso_sdk/test_bank_reason_master.rb
74
74
  - test/tsubaiso_sdk/test_bonus.rb
75
- - test/tsubaiso_sdk/test_bulk_scheduled_dates.rb
76
75
  - test/tsubaiso_sdk/test_corporate_master.rb
77
76
  - test/tsubaiso_sdk/test_customer.rb
78
77
  - test/tsubaiso_sdk/test_dept.rb
@@ -80,6 +79,7 @@ files:
80
79
  - test/tsubaiso_sdk/test_journal.rb
81
80
  - test/tsubaiso_sdk/test_journal_distribution.rb
82
81
  - test/tsubaiso_sdk/test_manual_journal.rb
82
+ - test/tsubaiso_sdk/test_payroll_attendances.rb
83
83
  - test/tsubaiso_sdk/test_payrolles.rb
84
84
  - test/tsubaiso_sdk/test_petty_cash_reason_master.rb
85
85
  - test/tsubaiso_sdk/test_physical_inventory_master.rb
@@ -94,6 +94,7 @@ files:
94
94
  - test/tsubaiso_sdk/test_staff_datum_master.rb
95
95
  - test/tsubaiso_sdk/test_tag.rb
96
96
  - test/tsubaiso_sdk/test_tax_master.rb
97
+ - test/tsubaiso_sdk/test_timecards.rb
97
98
  homepage: https://github.com/tsubaiso/tsubaiso-sdk-ruby
98
99
  licenses:
99
100
  - MIT
@@ -1,24 +0,0 @@
1
- require 'minitest/autorun'
2
- require_relative './common_setup_and_teardown.rb'
3
-
4
- class BulkScheduledDatesTest < Minitest::Test
5
- include CommonSetupAndTeardown
6
-
7
- def setup
8
- super('scheduled_dates')
9
- end
10
-
11
- def test_calc_scheduled_dates
12
- input_scheduled_dates = [
13
- { target_date: '2019-01-02', sight: '1m10', closing_day: '5', shift: 'before' },
14
- { target_date: nil, sight: '1m10', closing_day: '5', shift: 'before' }
15
- ]
16
- response = @api.bulk_scheduled_date(input_scheduled_dates)
17
- assert_equal '200', response[:status]
18
- assert_equal '2019-01-10', response[:json][0][:scheduled_date]
19
- assert_equal '200', response[:json][0][:status]
20
-
21
- assert_equal '422', response[:json][1][:status]
22
- assert_equal 'target date is required', respoonse[:json][1][:error]
23
- end
24
- end