tsubaiso-sdk 1.2.11 → 1.2.12
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 +4 -4
- data/lib/tsubaiso_sdk.rb +39 -0
- data/test/stubbings/stub_register.rb +2 -0
- data/test/tsubaiso_sdk/test_paid_holidays.rb +71 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0ab0090c36f342bd373de2eae64dcb501dc728cf500b4bfd7ff4c2ef2483cfb
|
4
|
+
data.tar.gz: 1ae4c0635a0debc2e331f51f2a9f2369c3efd3845cddec767105d1eecb011ff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0d7ca2a29d15722668a24d183f4e7147be4758f91ce04b09e20a45ca497f690c12f38a5e659b38c75bc4165a16881c65a4157d0fc9dc7c3b639244c139cfd4e
|
7
|
+
data.tar.gz: 84be4f0d1ef8cec0f0b0d8b51c162d314965b2235b310ab6b7a2684370b1fac4380d07e5fbdc8da898db55fe64043350b3815d3f46b7a19f3a82e846a0fa0277
|
data/lib/tsubaiso_sdk.rb
CHANGED
@@ -1818,6 +1818,45 @@ class TsubaisoSDK
|
|
1818
1818
|
api_request(uri, 'POST', params)
|
1819
1819
|
end
|
1820
1820
|
|
1821
|
+
def list_paid_holidays
|
1822
|
+
params = { 'format' => 'json' }
|
1823
|
+
uri = URI.parse(@base_url + '/paid_holidays/list')
|
1824
|
+
api_request(uri, 'GET', params)
|
1825
|
+
end
|
1826
|
+
|
1827
|
+
def list_forms_paid_holidays(staff_id)
|
1828
|
+
params = { 'format' => 'json' }
|
1829
|
+
uri = URI.parse(@base_url + "/paid_holidays/list_forms/#{staff_id}")
|
1830
|
+
api_request(uri, 'GET', params)
|
1831
|
+
end
|
1832
|
+
|
1833
|
+
def create_paid_holiday(options)
|
1834
|
+
candidate_keys = [
|
1835
|
+
:staff_id,
|
1836
|
+
:holiday,
|
1837
|
+
:full_or_half
|
1838
|
+
]
|
1839
|
+
params = create_parameters(candidate_keys, options)
|
1840
|
+
uri = URI.parse(@base_url + "/paid_holidays/create")
|
1841
|
+
api_request(uri, 'POST', params)
|
1842
|
+
end
|
1843
|
+
|
1844
|
+
def update_paid_holiday(holiday_id, options)
|
1845
|
+
candidate_keys = [
|
1846
|
+
:holiday,
|
1847
|
+
:full_or_half
|
1848
|
+
]
|
1849
|
+
params = create_parameters(candidate_keys, options)
|
1850
|
+
uri = URI.parse(@base_url + "/paid_holidays/update/#{holiday_id}")
|
1851
|
+
api_request(uri, 'POST', params)
|
1852
|
+
end
|
1853
|
+
|
1854
|
+
def destroy_paid_holiday(holiday_id)
|
1855
|
+
params = { 'format' => 'json' }
|
1856
|
+
uri = URI.parse(@base_url + "/paid_holidays/destroy/#{holiday_id}")
|
1857
|
+
api_request(uri, 'POST', params)
|
1858
|
+
end
|
1859
|
+
|
1821
1860
|
private
|
1822
1861
|
|
1823
1862
|
|
@@ -168,6 +168,8 @@ class StubRegister
|
|
168
168
|
stub_requests(:get, url(@root_url, resource, 'list', 2020, 1), @created_records)
|
169
169
|
when 'timecards'
|
170
170
|
stub_requests(:get, url(@root_url, resource, 'list', 2020, 1), @created_records)
|
171
|
+
when 'paid_holidays'
|
172
|
+
stub_requests(:get, url(@root_url, resource, 'list'), @created_records)
|
171
173
|
else
|
172
174
|
stub_requests(:get, url(@root_url, resource, 'list'), @created_records)
|
173
175
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class PaidHolidaysTest < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@paid_holiday_1 = {
|
9
|
+
staff_id: 2011,
|
10
|
+
holiday: {
|
11
|
+
start_timestamp: Date.new(2020, 8, 5),
|
12
|
+
finish_timestamp: Date.new(2020, 8, 7),
|
13
|
+
memo: '夏期休暇',
|
14
|
+
},
|
15
|
+
full_or_half: 'half'
|
16
|
+
}
|
17
|
+
|
18
|
+
@paid_holiday_2 = {
|
19
|
+
staff_id: 2011
|
20
|
+
}
|
21
|
+
|
22
|
+
super("paid_holidays")
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_list_paid_holidays
|
26
|
+
res = @api.list_paid_holidays
|
27
|
+
assert res
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_list_forms_paid_holidays
|
31
|
+
path = "test/stubbings/fixtures/paid_holidays_list_forms_response.json"
|
32
|
+
res_body = JSON.load(File.read(path))
|
33
|
+
|
34
|
+
base_url = @api.instance_variable_get(:@base_url)
|
35
|
+
WebMock.stub_request(:get, "#{base_url}/paid_holidays/list_forms/2011").to_return(
|
36
|
+
body: res_body.to_json,
|
37
|
+
status: 200,
|
38
|
+
headers: { 'Content-Type' => 'application/json' }
|
39
|
+
)
|
40
|
+
|
41
|
+
res = @api.list_forms_paid_holidays(2011)
|
42
|
+
assert res
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_create_paid_holiday
|
46
|
+
res = @api.create_paid_holiday(@paid_holiday_1)
|
47
|
+
assert res
|
48
|
+
|
49
|
+
res = @api.create_paid_holiday(@paid_holiday_2)
|
50
|
+
assert res
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_update_paid_holiday
|
54
|
+
options = {
|
55
|
+
holiday: {
|
56
|
+
is_ok: 1,
|
57
|
+
start_timestamp: Date.new(2020, 5, 1),
|
58
|
+
finish_timestamp: Date.new(2020, 5, 2),
|
59
|
+
memo: '申請時のメモ'
|
60
|
+
},
|
61
|
+
full_or_half: 'half'
|
62
|
+
}
|
63
|
+
res = @api.update_paid_holiday(0, options)
|
64
|
+
assert res
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_destroy_paid_holiday
|
68
|
+
res = @api.destroy_paid_holiday(0)
|
69
|
+
assert res
|
70
|
+
end
|
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.
|
4
|
+
version: 1.2.12
|
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-
|
11
|
+
date: 2022-02-28 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_paid_holidays.rb
|
82
83
|
- test/tsubaiso_sdk/test_payroll_attendances.rb
|
83
84
|
- test/tsubaiso_sdk/test_payrolles.rb
|
84
85
|
- test/tsubaiso_sdk/test_petty_cash_reason_master.rb
|