tsubaiso-sdk 1.2.1 → 1.2.8
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 +5 -5
- data/Rakefile +4 -3
- data/lib/tsubaiso_api.rb +67 -0
- data/lib/tsubaiso_sdk.rb +1511 -384
- data/sample.rb +120 -33
- data/test/stubbings/stub_register.rb +196 -0
- data/test/test_tsubaiso_api.rb +149 -0
- data/test/tsubaiso_sdk/common_setup_and_teardown.rb +23 -0
- data/test/tsubaiso_sdk/test_ap_reason_masters.rb +26 -0
- data/test/tsubaiso_sdk/test_api_history.rb +27 -0
- data/test/tsubaiso_sdk/test_ar_reason_masters.rb +26 -0
- data/test/tsubaiso_sdk/test_bank_account.rb +34 -0
- data/test/tsubaiso_sdk/test_bank_account_master.rb +119 -0
- data/test/tsubaiso_sdk/test_bank_account_transaction.rb +61 -0
- data/test/tsubaiso_sdk/test_bank_reason_master.rb +90 -0
- data/test/tsubaiso_sdk/test_bonus.rb +26 -0
- data/test/tsubaiso_sdk/test_corporate_master.rb +27 -0
- data/test/tsubaiso_sdk/test_customer.rb +71 -0
- data/test/tsubaiso_sdk/test_dept.rb +66 -0
- data/test/tsubaiso_sdk/test_fixed_assets.rb +18 -0
- data/test/tsubaiso_sdk/test_journal.rb +53 -0
- data/test/tsubaiso_sdk/test_journal_distribution.rb +29 -0
- data/test/tsubaiso_sdk/test_manual_journal.rb +84 -0
- data/test/tsubaiso_sdk/test_payrolles.rb +26 -0
- data/test/tsubaiso_sdk/test_petty_cash_reason_master.rb +72 -0
- data/test/tsubaiso_sdk/test_physical_inventory_master.rb +84 -0
- data/test/tsubaiso_sdk/test_purchase.rb +120 -0
- data/test/tsubaiso_sdk/test_reimbursement_reason_master.rb +27 -0
- data/test/tsubaiso_sdk/test_reimbursements.rb +90 -0
- data/test/tsubaiso_sdk/test_reimbursements_transactions.rb +75 -0
- data/test/tsubaiso_sdk/test_sale.rb +125 -0
- data/test/tsubaiso_sdk/test_scheduled_dates.rb +16 -0
- data/test/tsubaiso_sdk/test_staff.rb +26 -0
- data/test/tsubaiso_sdk/test_staff_data.rb +71 -0
- data/test/tsubaiso_sdk/test_staff_datum_master.rb +37 -0
- data/test/tsubaiso_sdk/test_tag.rb +53 -0
- data/test/tsubaiso_sdk/test_tax_master.rb +25 -0
- metadata +37 -6
- data/test/test_tsubaiso_sdk.rb +0 -807
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class CustomerTest < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@customer_1000 = {
|
9
|
+
name: 'テスト株式会社',
|
10
|
+
name_kana: 'テストカブシキガイシャ',
|
11
|
+
code: '10000',
|
12
|
+
tax_type_for_remittance_charge: '3',
|
13
|
+
used_in_ar: 1,
|
14
|
+
used_in_ap: 1,
|
15
|
+
is_valid: 1,
|
16
|
+
pay_date_if_holiday: 1,
|
17
|
+
receive_date_if_holiday: 1
|
18
|
+
}
|
19
|
+
super("customer_masters")
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_create_customer
|
23
|
+
customer = @api.create_customer(@customer_1000)
|
24
|
+
|
25
|
+
assert_equal 200, customer[:status].to_i, customer.inspect
|
26
|
+
assert_equal @customer_1000[:name], customer[:json][:name]
|
27
|
+
assert_equal @customer_1000[:pay_date_if_holiday], customer[:json][:pay_date_if_holiday]
|
28
|
+
assert_equal @customer_1000[:receive_date_if_holiday], customer[:json][:receive_date_if_holiday]
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_update_customer
|
32
|
+
customer = @api.create_customer(@customer_1000)
|
33
|
+
options = {
|
34
|
+
id: customer[:json][:id],
|
35
|
+
name: 'New Customer Name',
|
36
|
+
pay_date_if_holiday: 0,
|
37
|
+
receive_date_if_holiday: 0
|
38
|
+
}
|
39
|
+
|
40
|
+
updated_customer = @api.update_customer(options)
|
41
|
+
assert_equal 200, updated_customer[:status].to_i
|
42
|
+
assert_equal customer[:json][:id], updated_customer[:json][:id]
|
43
|
+
assert_equal options[:name], updated_customer[:json][:name]
|
44
|
+
assert_equal options[:pay_date_if_holiday], updated_customer[:json][:pay_date_if_holiday]
|
45
|
+
assert_equal options[:receive_date_if_holiday], updated_customer[:json][:receive_date_if_holiday]
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_show_customer
|
49
|
+
customer = @api.create_customer(@customer_1000)
|
50
|
+
get_customer = @api.show_customer(customer[:json][:id])
|
51
|
+
assert_equal 200, get_customer[:status].to_i, get_customer.inspect
|
52
|
+
assert_equal customer[:json][:id], get_customer[:json][:id]
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_show_customer_by_code
|
56
|
+
customer = @api.create_customer(@customer_1000)
|
57
|
+
|
58
|
+
get_customer = @api.show_customer_by_code(@customer_1000[:code])
|
59
|
+
assert_equal 200, get_customer[:status].to_i, get_customer.inspect
|
60
|
+
assert_equal customer[:json][:id], get_customer[:json][:id]
|
61
|
+
assert_equal customer[:json][:code], get_customer[:json][:code]
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_list_customers
|
65
|
+
customer_1000 = @api.create_customer(@customer_1000)
|
66
|
+
customer_1000_id = customer_1000[:json][:id]
|
67
|
+
customer_list = @api.list_customers
|
68
|
+
assert_equal 200, customer_list[:status].to_i, customer_list.inspect
|
69
|
+
assert(customer_list[:json].any? { |x| x[:id] == customer_1000_id })
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class DeptsTest < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@dept_1 = {
|
9
|
+
sort_no: 12_345_678,
|
10
|
+
code: 'test_code',
|
11
|
+
name: 'テスト部門',
|
12
|
+
name_abbr: 'テストブモン',
|
13
|
+
color: '#ffffff',
|
14
|
+
memo: 'テストメモ',
|
15
|
+
start_date: '2016-01-01',
|
16
|
+
finish_date: '2016-01-02'
|
17
|
+
}
|
18
|
+
super("depts")
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_create_dept
|
22
|
+
dept = @api.create_dept(@dept_1)
|
23
|
+
assert_equal 200, dept[:status].to_i, dept.inspect
|
24
|
+
assert_equal @dept_1[:code], dept[:json][:code]
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_update_dept
|
28
|
+
dept = @api.create_dept(@dept_1)
|
29
|
+
options = {
|
30
|
+
id: dept[:json][:id],
|
31
|
+
sort_no: 98_765,
|
32
|
+
memo: 'updated at test',
|
33
|
+
name: '更新部門',
|
34
|
+
name_abbr: '更新部門'
|
35
|
+
}
|
36
|
+
|
37
|
+
updated_dept = @api.update_dept(dept[:json][:id], options)
|
38
|
+
assert_equal 200, updated_dept[:status].to_i, updated_dept.inspect
|
39
|
+
assert_equal options[:memo], updated_dept[:json][:memo]
|
40
|
+
assert_equal options[:name], updated_dept[:json][:name]
|
41
|
+
assert_equal options[:name_abbr], updated_dept[:json][:name_abbr]
|
42
|
+
ensure
|
43
|
+
@api.destroy_dept(updated_dept[:json][:id] || dept[:json][:id]) if updated_dept[:json][:id] || dept[:json][:id]
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_show_dept
|
47
|
+
dept = @api.create_dept(@dept_1)
|
48
|
+
dept = @api.show_dept(dept[:json][:id])
|
49
|
+
|
50
|
+
assert_equal 200, dept[:status].to_i, dept.inspect
|
51
|
+
assert_equal @dept_1[:memo], dept[:json][:memo]
|
52
|
+
@api.destroy_dept(dept[:json][:id])
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_list_depts
|
56
|
+
dept = @api.create_dept(@dept_1)
|
57
|
+
assert_equal 200, dept[:status].to_i, dept.inspect
|
58
|
+
|
59
|
+
depts = @api.list_depts
|
60
|
+
assert_equal 200, depts[:status].to_i, depts.inspect
|
61
|
+
assert(depts[:json].any? { |x| x[:id] == dept[:json][:id] })
|
62
|
+
ensure
|
63
|
+
@api.destroy_dept(dept[:json][:id]) if dept[:json][:id]
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class FixedAssetsTest < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
super('fixed_assets')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_list_fixed_assets
|
12
|
+
list = @api.list_fixed_assets
|
13
|
+
assert_equal 200, list[:status].to_i, list.inspect
|
14
|
+
assert list[:json]
|
15
|
+
assert !list[:json].empty?
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class JournalsTest < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
super('journals')
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_list_journals
|
12
|
+
options = { start_date: '2019-12-01', finish_date: '2019-12-31' }
|
13
|
+
journals_list = @api.list_journals(options)
|
14
|
+
records = journals_list[:json][:records]
|
15
|
+
assert_equal 200, journals_list[:status].to_i, journals_list.inspect
|
16
|
+
assert_equal records.size, 3
|
17
|
+
|
18
|
+
options = { price_min: 10_800, price_max: 10_800 }
|
19
|
+
journals_list = @api.list_journals(options)
|
20
|
+
records = journals_list[:json][:records]
|
21
|
+
assert_equal 200, journals_list[:status].to_i, journals_list.inspect
|
22
|
+
assert_equal records.size, 3
|
23
|
+
record_prices = records.map { |x| x[:journal_dcs].map { |y| y[:debit][:price_excluding_tax] } }.flatten(1)
|
24
|
+
record_prices.each do |price|
|
25
|
+
assert_equal price, 10_800
|
26
|
+
end
|
27
|
+
|
28
|
+
options = { dept_code: 'SETSURITSU' }
|
29
|
+
journals_list = @api.list_journals(options)
|
30
|
+
records = journals_list[:json][:records]
|
31
|
+
assert_equal 200, journals_list[:status].to_i, journals_list.inspect
|
32
|
+
assert_equal records.size, 3
|
33
|
+
record_depts = records.map { |x| x[:journal_dcs].map { |y| y[:dept_code] } }.flatten(1)
|
34
|
+
record_depts.each do |dept|
|
35
|
+
assert_equal dept, "SETSURITSU"
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_show_journal
|
41
|
+
journal0 = @api.show_journal(0)
|
42
|
+
journal1 = @api.show_journal(1)
|
43
|
+
journal2 = @api.show_journal(2)
|
44
|
+
|
45
|
+
assert_equal 200, journal0[:status].to_i, journal0.inspect
|
46
|
+
assert_equal 200, journal0[:status].to_i, journal1.inspect
|
47
|
+
assert_equal 200, journal0[:status].to_i, journal2.inspect
|
48
|
+
|
49
|
+
assert_equal 0.to_s, journal0[:json][:record][:id]
|
50
|
+
assert_equal 1.to_s, journal1[:json][:record][:id]
|
51
|
+
assert_equal 2.to_s, journal2[:json][:record][:id]
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class JournalDistriibutionTest < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@journal_distribution_1 = {
|
9
|
+
title: 'title',
|
10
|
+
start_date: '2012-07-01',
|
11
|
+
finish_date: '2012-07-31',
|
12
|
+
account_codes: ['135~999','604'],
|
13
|
+
dept_code: 'SETSURITSU',
|
14
|
+
memo: '',
|
15
|
+
criteria: 'dept',
|
16
|
+
target_timestamp: '2017-02-01',
|
17
|
+
distribution_conditions: { 'SETSURITSU' => '1', 'COMMON' => '1' }
|
18
|
+
}
|
19
|
+
super('journal_distributions')
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_create_journal_distribution
|
23
|
+
journal_distribution = @api.create_journal_distribution(@journal_distribution_1)
|
24
|
+
assert_equal 200, journal_distribution[:status].to_i, journal_distribution.inspect
|
25
|
+
assert_equal Time.parse(@journal_distribution_1[:target_timestamp]), Time.parse(journal_distribution[:json][:target_ym])
|
26
|
+
assert_equal @journal_distribution_1[:account_codes], journal_distribution[:json][:target_conditions_account_codes].split(',').map{|x| x.delete("'")}
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class ManualJournalTest < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@manual_journal_1 = {
|
9
|
+
journal_timestamp: '2016-04-01',
|
10
|
+
journal_dcs: [
|
11
|
+
{
|
12
|
+
debit: {
|
13
|
+
account_code: '110',
|
14
|
+
price_including_tax: 200_000,
|
15
|
+
tax_type: 0
|
16
|
+
},
|
17
|
+
credit: {
|
18
|
+
account_code: '100',
|
19
|
+
price_including_tax: 200_000,
|
20
|
+
tax_type: 0
|
21
|
+
}
|
22
|
+
},
|
23
|
+
{
|
24
|
+
debit: {
|
25
|
+
account_code: '1',
|
26
|
+
price_including_tax: 54_321,
|
27
|
+
tax_type: 0
|
28
|
+
},
|
29
|
+
credit: {
|
30
|
+
account_code: '110',
|
31
|
+
price_including_tax: 54_321,
|
32
|
+
tax_type: 0
|
33
|
+
},
|
34
|
+
memo: 'Created From API'
|
35
|
+
}
|
36
|
+
],
|
37
|
+
data_partner: { link_url: 'www.example.com/7', id_code: '7' }
|
38
|
+
}
|
39
|
+
super('manual_journals')
|
40
|
+
end
|
41
|
+
|
42
|
+
def test_list_manual_journals
|
43
|
+
manual_journals_list = @api.list_manual_journals(2016, 4)
|
44
|
+
assert_equal 200, manual_journals_list[:status].to_i, manual_journals_list.inspect
|
45
|
+
assert !manual_journals_list[:json].empty?
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_show_manual_journal
|
49
|
+
manual_journal = @api.create_manual_journal(@manual_journal_1)
|
50
|
+
manual_journals_list = @api.list_manual_journals(2016, 4)
|
51
|
+
last_manual_journal_id = manual_journals_list[:json].last[:id]
|
52
|
+
|
53
|
+
manual_journal = @api.show_manual_journal(last_manual_journal_id)
|
54
|
+
assert_equal 200, manual_journal[:status].to_i, manual_journal.inspect
|
55
|
+
assert_equal last_manual_journal_id, manual_journal[:json][:id]
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_create_manual_journal
|
59
|
+
manual_journal = @api.create_manual_journal(@manual_journal_1)
|
60
|
+
assert_equal 200, manual_journal[:status].to_i, manual_journal.inspect
|
61
|
+
assert_equal @manual_journal_1[:journal_dcs][0][:debit][:price_including_tax], manual_journal[:json][:journal_dcs][0][:debit][:price_including_tax]
|
62
|
+
assert_equal @manual_journal_1[:data_partner][:id_code], manual_journal[:json][:data_partner][:id_code]
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_update_manual_journal
|
66
|
+
manual_journal = @api.create_manual_journal(@manual_journal_1)
|
67
|
+
options = {
|
68
|
+
id: manual_journal[:json][:id],
|
69
|
+
journal_dcs: manual_journal[:json][:journal_dcs],
|
70
|
+
data_partner: { :id_code => '700' },
|
71
|
+
}
|
72
|
+
options[:journal_dcs][0][:debit][:price_including_tax] = 2000
|
73
|
+
options[:journal_dcs][0][:credit][:price_including_tax] = 2000
|
74
|
+
options[:journal_dcs][0][:memo] = 'Updated from API'
|
75
|
+
options[:journal_dcs][1][:dept_code] = 'SETSURITSU'
|
76
|
+
|
77
|
+
updated_manual_journal = @api.update_manual_journal(options)
|
78
|
+
assert_equal 200, updated_manual_journal[:status].to_i, updated_manual_journal.inspect
|
79
|
+
assert_equal options[:journal_dcs][0][:debit][:price_including_tax], updated_manual_journal[:json][:journal_dcs][0][:debit][:price_including_tax]
|
80
|
+
assert_equal options[:journal_dcs][0][:memo], updated_manual_journal[:json][:journal_dcs][0][:memo]
|
81
|
+
assert_equal options[:journal_dcs][1][:dept_code], updated_manual_journal[:json][:journal_dcs][1][:dept_code]
|
82
|
+
assert_equal options[:data_partner][:id_code], updated_manual_journal[:json][:data_partner][:id_code]
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class PayrollsTest < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
super("payrolls")
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_show_payroll
|
12
|
+
payrolls_list = @api.list_payrolls(2017, 2)
|
13
|
+
first_payroll_id = payrolls_list[:json].first[:id]
|
14
|
+
|
15
|
+
payroll = @api.show_payroll(first_payroll_id)
|
16
|
+
assert_equal 200, payroll[:status].to_i, payroll.inspect
|
17
|
+
assert_equal first_payroll_id, payroll[:json][:id]
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_list_payrolls
|
21
|
+
payrolls_list = @api.list_payrolls(2017, 2)
|
22
|
+
|
23
|
+
assert_equal 200, payrolls_list[:status].to_i, payrolls_list.inspect
|
24
|
+
assert !payrolls_list.empty?
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative 'common_setup_and_teardown'
|
3
|
+
|
4
|
+
class PettyCashReasonMaster < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@petty_cash_reason_master_1 = {
|
9
|
+
reason_code: 'sdk_test_create',
|
10
|
+
reason_name: 'SDK before update',
|
11
|
+
dc: 'd',
|
12
|
+
account_code: '100',
|
13
|
+
is_valid: '0',
|
14
|
+
memo: 'this is test before update',
|
15
|
+
port_type: '0',
|
16
|
+
sort_number: '0'
|
17
|
+
}
|
18
|
+
|
19
|
+
@petty_cash_reason_master_2 = {
|
20
|
+
reason_code: "sdk_test_create2",
|
21
|
+
reason_name: "TEST_REASON",
|
22
|
+
dc: "d",
|
23
|
+
account_code: "999",
|
24
|
+
is_valid: "0",
|
25
|
+
memo: "This is Test reason.",
|
26
|
+
port_type: "0",
|
27
|
+
sort_number: "0"
|
28
|
+
}
|
29
|
+
super("petty_cash_reason_masters")
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_create_petty_cash_reason_master
|
33
|
+
created_pcrm = @api.create_petty_cash_reason_master(@petty_cash_reason_master_1)
|
34
|
+
assert_equal 200, created_pcrm[:status].to_i, created_pcrm.inspect
|
35
|
+
assert_equal @petty_cash_reason_master_1[:reason_code], created_pcrm[:json][:reason_code]
|
36
|
+
|
37
|
+
shown_prcm = @api.show_petty_cash_reason_master(created_pcrm[:json][:id].to_i)
|
38
|
+
assert_equal 200, created_pcrm[:status].to_i, created_pcrm.inspect
|
39
|
+
@petty_cash_reason_master_1.each_pair do |key,val|
|
40
|
+
assert_equal val, shown_prcm[:json][key], "col :#{key}, #{val} was expected but #{shown_prcm[:json][key]} was found."
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_update_petty_cash_reason_master
|
45
|
+
old_petty_cash_reason_master = @api.create_petty_cash_reason_master(@petty_cash_reason_master_1)
|
46
|
+
options = {
|
47
|
+
reason_name: 'updating from API',
|
48
|
+
memo: 'updating memo from API'
|
49
|
+
}
|
50
|
+
updated_petty_cash_reason_master = @api.update_petty_cash_reason_master(old_petty_cash_reason_master[:json][:id], options)
|
51
|
+
|
52
|
+
assert_equal 200, updated_petty_cash_reason_master[:status].to_i, updated_petty_cash_reason_master.inspect
|
53
|
+
assert_equal options[:reason_name], updated_petty_cash_reason_master[:json][:reason_name]
|
54
|
+
assert_equal options[:memo], updated_petty_cash_reason_master[:json][:memo]
|
55
|
+
assert_equal old_petty_cash_reason_master[:json][:reason_code], updated_petty_cash_reason_master[:json][:reason_code]
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_list_petty_cash_reason_masters
|
59
|
+
listed_pcrms = @api.list_petty_cash_reason_masters
|
60
|
+
assert_equal listed_pcrms[:json].size, 2
|
61
|
+
pcrm1 = listed_pcrms[:json].find{|record| record[:reason_code] == "sdk_test_create"}
|
62
|
+
@petty_cash_reason_master_1.each_pair do |key, val|
|
63
|
+
assert_equal val, pcrm1[key], "col :#{key}, #{val} was expected but #{pcrm1[key]} was found."
|
64
|
+
end
|
65
|
+
|
66
|
+
pcrm2 = listed_pcrms[:json].find{|record| record[:reason_code] == "sdk_test_create2"}
|
67
|
+
@petty_cash_reason_master_2.each_pair do |key, val|
|
68
|
+
assert_equal val, pcrm2[key], "col :#{key}, #{val} was expected but #{pcrm2[key]} was found."
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require_relative './common_setup_and_teardown.rb'
|
3
|
+
|
4
|
+
class PhysicalInventoryMaster < Minitest::Test
|
5
|
+
include CommonSetupAndTeardown
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@pim_201901 = {
|
9
|
+
name: 'sendai',
|
10
|
+
memo: 'this inventory is registered from SDK test',
|
11
|
+
start_ymd: '2019/01/01',
|
12
|
+
finish_ymd: nil,
|
13
|
+
tag_list: 'GROUP2_1,GROUP3_2',
|
14
|
+
dept_code: 'NEVER_ENDING'
|
15
|
+
}
|
16
|
+
|
17
|
+
@pim_201902 = {
|
18
|
+
name: 'osaka',
|
19
|
+
memo: 'this inventory is registered from SDK test #2',
|
20
|
+
start_ymd: '2019/02/01',
|
21
|
+
finish_ymd: '2020/12/02'
|
22
|
+
}
|
23
|
+
|
24
|
+
@pim_201903 = {
|
25
|
+
name: 'nagoya',
|
26
|
+
memo: 'this inventory is registered from SDK test #3',
|
27
|
+
start_ymd: '2019/03/01',
|
28
|
+
finish_ymd: '2020/12/03'
|
29
|
+
}
|
30
|
+
super("physical_inventory_masters")
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_create_physical_inventory_masters
|
34
|
+
physical_inventory_master = @api.create_physical_inventory_masters(@pim_201901)
|
35
|
+
assert physical_inventory_master[:json] != nil
|
36
|
+
|
37
|
+
assert_equal 200, physical_inventory_master[:status].to_i, physical_inventory_master.inspect
|
38
|
+
assert_equal @pim_201901[:name], physical_inventory_master[:json][:name]
|
39
|
+
assert_equal @pim_201901[:memo], physical_inventory_master[:json][:memo]
|
40
|
+
assert_equal @pim_201901[:start_ymd], physical_inventory_master[:json][:start_ymd]
|
41
|
+
assert_equal @pim_201901[:finish_ymd], physical_inventory_master[:json][:finish_ymd]
|
42
|
+
assert_equal @pim_201901[:tag_list], physical_inventory_master[:json][:tag_list].join(",")
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_list_physical_inventory_masters
|
46
|
+
pim_201901 = @api.create_physical_inventory_masters(@pim_201901)
|
47
|
+
pim_201902 = @api.create_physical_inventory_masters(@pim_201902)
|
48
|
+
pim_201903 = @api.create_physical_inventory_masters(@pim_201903)
|
49
|
+
|
50
|
+
pim_201901_id = pim_201901[:json][:id]
|
51
|
+
pim_201902_id = pim_201902[:json][:id]
|
52
|
+
pim_201903_id = pim_201903[:json][:id]
|
53
|
+
|
54
|
+
list_physical_inventory_masters = @api.list_physical_inventory_masters
|
55
|
+
assert_equal 200, list_physical_inventory_masters[:status].to_i, list_physical_inventory_masters.inspect
|
56
|
+
|
57
|
+
assert(list_physical_inventory_masters[:json].any? { |x| x[:id] == pim_201901_id })
|
58
|
+
assert(list_physical_inventory_masters[:json].any? { |x| x[:id] == pim_201902_id })
|
59
|
+
assert(list_physical_inventory_masters[:json].any? { |x| x[:id] == pim_201903_id })
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_update_physical_inventory_masters
|
63
|
+
physical_inventory_master = @api.create_physical_inventory_masters(@pim_201901)
|
64
|
+
assert physical_inventory_master[:json][:id], physical_inventory_master
|
65
|
+
options = {
|
66
|
+
id: physical_inventory_master[:json][:id],
|
67
|
+
memo: 'Updated memo',
|
68
|
+
name: 'kanazawa',
|
69
|
+
start_ymd: '2019/11/21',
|
70
|
+
}
|
71
|
+
# NOTE: updating dept and tag_list is not permitted in physical_inventory_master.
|
72
|
+
updated_physical_inventory_master = @api.update_physical_inventory_masters(options)
|
73
|
+
assert physical_inventory_master[:json] != nil
|
74
|
+
|
75
|
+
assert_equal 200, updated_physical_inventory_master[:status].to_i, updated_physical_inventory_master.inspect
|
76
|
+
assert_equal options[:id], updated_physical_inventory_master[:json][:id]
|
77
|
+
assert_equal options[:memo], updated_physical_inventory_master[:json][:memo]
|
78
|
+
assert_equal options[:name], updated_physical_inventory_master[:json][:name]
|
79
|
+
assert_equal options[:start_ymd], updated_physical_inventory_master[:json][:start_ymd]
|
80
|
+
assert_equal physical_inventory_master[:json][:finish_ymd], updated_physical_inventory_master[:json][:finish_ymd]
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|