tsubaiso-sdk 1.2.10 → 1.2.13

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: 6041bfb764c019434b6bb990f644d70cf56f76e8d842782c84aa886153f109c5
4
- data.tar.gz: ca027edc06a1dfb6078d5c3f75adbcc970196166b6193d82df61ca4753d1fd44
3
+ metadata.gz: ec41b4df9639ca7f338fbb1a004f8411c90d7c48be7fb8b89cd876cf63ed5254
4
+ data.tar.gz: eb4b3ef1927418867425f11bdbcdff76437cbe8cd477089d5076480f7756a829
5
5
  SHA512:
6
- metadata.gz: 333ea65f8728aad45ab504698bcf4462ba3102f75775d7bda4680af5e30b9fe3ce2c464004bad9c00ed3964aa8093b2b24adcade2060fb2730c17bc46f969cf8
7
- data.tar.gz: 4ff7b9f3829efcbc7878513638daa9ed6b5d37de8606597a5697ac9ecb649d4b629dedc1d6848a8b33b75e55ebdd1f55d4ddf7c471359764add3dac4450c1d28
6
+ metadata.gz: b86e3df1e6c9993d99a21afd233deafef7f5944c65883d1be17deda047f3c649fec65110ebf05b4d2b5b1114aa5f22a12618c18479d4c2fbd5124209bdfdec1b
7
+ data.tar.gz: '089fce1bd0be1a320af5b970b229d066e1ffeb1324b1dab4227b4f03bb06c03c3a8814e0a21be4cd81ec90f92b457a8f955830ad8e5bb6d4f8563cbe63d582b9'
data/lib/tsubaiso_sdk.rb CHANGED
@@ -681,6 +681,8 @@ class TsubaisoSDK
681
681
  'port_type' => options[:port_type],
682
682
  'tag_list' => options[:tag_list],
683
683
  'data_partner' => options[:data_partner],
684
+ 'scheduled_pay_method' => options[:scheduled_pay_method],
685
+ 'scheduled_pay_interface_id' => options[:scheduled_pay_interface_id],
684
686
  'format' => 'json'
685
687
  }
686
688
  uri = URI.parse(@base_url + '/ap_payments/create')
@@ -701,6 +703,8 @@ class TsubaisoSDK
701
703
  'tag_list' => options[:tag_list],
702
704
  'data_partner' => options[:data_partner],
703
705
  'key' => options[:key],
706
+ 'scheduled_pay_method' => options[:scheduled_pay_method],
707
+ 'scheduled_pay_interface_id' => options[:scheduled_pay_interface_id],
704
708
  'format' => 'json'
705
709
  }
706
710
  uri = URI.parse(@base_url + '/ap_payments/find_or_create')
@@ -1605,8 +1609,9 @@ class TsubaisoSDK
1605
1609
  api_request(uri, 'GET', params)
1606
1610
  end
1607
1611
 
1608
- def list_ap_cashflow_schedule(year, month)
1612
+ def list_ap_cashflow_schedule(year, month, options = {})
1609
1613
  params = { 'format' => 'json' }
1614
+ params['pay_method'] = options[:pay_method] if options
1610
1615
  uri = URI.parse(@base_url + "/ap_reports/list_cashflow_schedule/#{year}/#{month}")
1611
1616
  api_request(uri, 'GET', params)
1612
1617
  end
@@ -1778,6 +1783,110 @@ class TsubaisoSDK
1778
1783
  api_request(uri, 'POST', params)
1779
1784
  end
1780
1785
 
1786
+ def list_payroll_attendances(year, month)
1787
+ params = { 'format' => 'json' }
1788
+ uri = URI.parse(@base_url + "/payroll_attendances/list/#{year.to_i}/#{month.to_i}")
1789
+ api_request(uri, 'GET', params)
1790
+ end
1791
+
1792
+ def list_timecards(year, month)
1793
+ params = { 'format' => 'json' }
1794
+ uri = URI.parse(@base_url + "/timecards/list/#{year.to_i}/#{month.to_i}")
1795
+ api_request(uri, 'GET', params)
1796
+ end
1797
+
1798
+ def create_timecard(options)
1799
+ candidate_keys = [
1800
+ :staff_id,
1801
+ :target_ymd,
1802
+ :punch_time_0,
1803
+ :punch_time_1,
1804
+ :punch_time_2,
1805
+ :punch_time_3,
1806
+ :additional_memo,
1807
+ ]
1808
+ params = create_parameters(candidate_keys, options)
1809
+ uri = URI.parse(@base_url + "/timecards/create")
1810
+ api_request(uri, 'POST', params)
1811
+ end
1812
+
1813
+ def update_timecard(options)
1814
+ candidate_keys = [
1815
+ :punch_time_0,
1816
+ :punch_time_1,
1817
+ :punch_time_2,
1818
+ :punch_time_3,
1819
+ :additional_memo,
1820
+ ]
1821
+ params = create_parameters(candidate_keys, options)
1822
+ uri = URI.parse(@base_url + "/timecards/update/#{options[:id]}")
1823
+ api_request(uri, 'POST', params)
1824
+ end
1825
+
1826
+ def list_paid_holidays
1827
+ params = { 'format' => 'json' }
1828
+ uri = URI.parse(@base_url + '/paid_holidays/list')
1829
+ api_request(uri, 'GET', params)
1830
+ end
1831
+
1832
+ def list_forms_paid_holidays(staff_id)
1833
+ params = { 'format' => 'json' }
1834
+ uri = URI.parse(@base_url + "/paid_holidays/list_forms/#{staff_id}")
1835
+ api_request(uri, 'GET', params)
1836
+ end
1837
+
1838
+ def create_paid_holiday(options)
1839
+ candidate_keys = [
1840
+ :staff_id,
1841
+ :holiday,
1842
+ :full_or_half
1843
+ ]
1844
+ params = create_parameters(candidate_keys, options)
1845
+ uri = URI.parse(@base_url + "/paid_holidays/create")
1846
+ api_request(uri, 'POST', params)
1847
+ end
1848
+
1849
+ def update_paid_holiday(holiday_id, options)
1850
+ candidate_keys = [
1851
+ :holiday,
1852
+ :full_or_half
1853
+ ]
1854
+ params = create_parameters(candidate_keys, options)
1855
+ uri = URI.parse(@base_url + "/paid_holidays/update/#{holiday_id}")
1856
+ api_request(uri, 'POST', params)
1857
+ end
1858
+
1859
+ def destroy_paid_holiday(holiday_id)
1860
+ params = { 'format' => 'json' }
1861
+ uri = URI.parse(@base_url + "/paid_holidays/destroy/#{holiday_id}")
1862
+ api_request(uri, 'POST', params)
1863
+ end
1864
+
1865
+ def list_corporate_data(options)
1866
+ candidate_keys = [
1867
+ :code
1868
+ ]
1869
+ params = create_parameters(candidate_keys, options)
1870
+ uri = URI.parse(@base_url + "/corporate_data/list")
1871
+ api_request(uri, 'GET', params)
1872
+ end
1873
+
1874
+ # options: id: 会社基本情報Id, data: Base64エンコードデータ, filename: ファイル名, contenttype: Content-Type
1875
+ # id で指定した corporate_datum が存在している必要があります。
1876
+ # その corporate_datum の corporate_datum_master の input_type が 'image' である必要があります。
1877
+ # 既存の添付ファイルは削除されて差し替えられます。
1878
+ def update_attachment_to_corporate_data(options)
1879
+ candidate_keys = [
1880
+ :id,
1881
+ :data,
1882
+ :filename,
1883
+ :contenttype
1884
+ ]
1885
+ params = create_parameters(candidate_keys, options)
1886
+ uri = URI.parse(@base_url + '/corporate_data/update_attachment')
1887
+ api_request(uri, 'POST', params)
1888
+ end
1889
+
1781
1890
  private
1782
1891
 
1783
1892
 
@@ -164,6 +164,12 @@ 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)
171
+ when 'paid_holidays'
172
+ stub_requests(:get, url(@root_url, resource, 'list'), @created_records)
167
173
  else
168
174
  stub_requests(:get, url(@root_url, resource, 'list'), @created_records)
169
175
  end
@@ -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
@@ -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
@@ -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
@@ -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)
@@ -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.13
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-08-19 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
@@ -79,6 +80,8 @@ files:
79
80
  - test/tsubaiso_sdk/test_journal.rb
80
81
  - test/tsubaiso_sdk/test_journal_distribution.rb
81
82
  - test/tsubaiso_sdk/test_manual_journal.rb
83
+ - test/tsubaiso_sdk/test_paid_holidays.rb
84
+ - test/tsubaiso_sdk/test_payroll_attendances.rb
82
85
  - test/tsubaiso_sdk/test_payrolles.rb
83
86
  - test/tsubaiso_sdk/test_petty_cash_reason_master.rb
84
87
  - test/tsubaiso_sdk/test_physical_inventory_master.rb
@@ -93,6 +96,7 @@ files:
93
96
  - test/tsubaiso_sdk/test_staff_datum_master.rb
94
97
  - test/tsubaiso_sdk/test_tag.rb
95
98
  - test/tsubaiso_sdk/test_tax_master.rb
99
+ - test/tsubaiso_sdk/test_timecards.rb
96
100
  homepage: https://github.com/tsubaiso/tsubaiso-sdk-ruby
97
101
  licenses:
98
102
  - MIT