tsubaiso-sdk 1.2.10 → 1.2.11

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: 6041bfb764c019434b6bb990f644d70cf56f76e8d842782c84aa886153f109c5
4
- data.tar.gz: ca027edc06a1dfb6078d5c3f75adbcc970196166b6193d82df61ca4753d1fd44
3
+ metadata.gz: 1be2b8de64e9cb4337cdbb2a282a463222e0f8b0bdd5bb37e3574cd9c9bb83c2
4
+ data.tar.gz: 382c33d6ce383694d7a431c0b9cda89f5a7ef781add64a9a8e6fc0b0fc1bdf30
5
5
  SHA512:
6
- metadata.gz: 333ea65f8728aad45ab504698bcf4462ba3102f75775d7bda4680af5e30b9fe3ce2c464004bad9c00ed3964aa8093b2b24adcade2060fb2730c17bc46f969cf8
7
- data.tar.gz: 4ff7b9f3829efcbc7878513638daa9ed6b5d37de8606597a5697ac9ecb649d4b629dedc1d6848a8b33b75e55ebdd1f55d4ddf7c471359764add3dac4450c1d28
6
+ metadata.gz: 9ad39f6a3293571ed92e0d9d849e82b0b2c82b29db33e5af1c02c69ac2a3f43a3d62febedfd03ec8b6270deba53cf3d73641a53bdbd92678d37283edcfee5005
7
+ data.tar.gz: d57e571877d810e4050ed2cf7e613cc1803d1e905c1e48fe11623ffa755c917e3fffddfec3cd158950ebc4c6f2a8e8719e509309d35447256731027f666d4a50
data/lib/tsubaiso_sdk.rb CHANGED
@@ -1778,6 +1778,46 @@ class TsubaisoSDK
1778
1778
  api_request(uri, 'POST', params)
1779
1779
  end
1780
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
+
1781
1821
  private
1782
1822
 
1783
1823
 
@@ -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
@@ -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.10
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-12-08 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
@@ -79,6 +79,7 @@ files:
79
79
  - test/tsubaiso_sdk/test_journal.rb
80
80
  - test/tsubaiso_sdk/test_journal_distribution.rb
81
81
  - test/tsubaiso_sdk/test_manual_journal.rb
82
+ - test/tsubaiso_sdk/test_payroll_attendances.rb
82
83
  - test/tsubaiso_sdk/test_payrolles.rb
83
84
  - test/tsubaiso_sdk/test_petty_cash_reason_master.rb
84
85
  - test/tsubaiso_sdk/test_physical_inventory_master.rb
@@ -93,6 +94,7 @@ files:
93
94
  - test/tsubaiso_sdk/test_staff_datum_master.rb
94
95
  - test/tsubaiso_sdk/test_tag.rb
95
96
  - test/tsubaiso_sdk/test_tax_master.rb
97
+ - test/tsubaiso_sdk/test_timecards.rb
96
98
  homepage: https://github.com/tsubaiso/tsubaiso-sdk-ruby
97
99
  licenses:
98
100
  - MIT