freee 0.3.1 → 1.0.0
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/.gitignore +1 -0
- data/README.md +25 -1
- data/freee.gemspec +2 -0
- data/lib/freee/{account.rb → account_item.rb} +3 -3
- data/lib/freee/base.rb +13 -2
- data/lib/freee/company.rb +4 -0
- data/lib/freee/deal.rb +4 -2
- data/lib/freee/item.rb +4 -2
- data/lib/freee/obj/account_item.rb +5 -0
- data/lib/freee/obj/response.rb +1 -1
- data/lib/freee/obj/{account.rb → section.rb} +1 -1
- data/lib/freee/obj/{wallet.rb → tag.rb} +1 -1
- data/lib/freee/obj/{amount.rb → wallet_txn.rb} +1 -1
- data/lib/freee/partner.rb +4 -2
- data/lib/freee/section.rb +15 -0
- data/lib/freee/tag.rb +15 -0
- data/lib/freee/tax.rb +2 -2
- data/lib/freee/transfer.rb +4 -2
- data/lib/freee/version.rb +1 -1
- data/lib/freee/{wallet.rb → wallet_txn.rb} +5 -4
- data/lib/freee/walletable.rb +6 -0
- data/spec/account_item_spec.rb +44 -0
- data/spec/base_spec.rb +3 -9
- data/spec/company_spec.rb +53 -36
- data/spec/deal_spec.rb +150 -93
- data/spec/fixtures/account_items.json +20 -0
- data/spec/fixtures/companies.json +11 -0
- data/spec/fixtures/company.json +13 -0
- data/spec/fixtures/create_deal.json +1 -0
- data/spec/fixtures/create_item.json +6 -0
- data/spec/fixtures/create_partner.json +1 -0
- data/spec/fixtures/create_section.json +1 -0
- data/spec/fixtures/create_tag.json +1 -0
- data/spec/fixtures/create_transfer.json +1 -0
- data/spec/fixtures/create_wallet_txn.json +11 -0
- data/spec/fixtures/create_walletable.json +1 -0
- data/spec/fixtures/deal.json +34 -0
- data/spec/fixtures/deals.json +36 -0
- data/spec/fixtures/item.json +9 -0
- data/spec/fixtures/items.json +11 -0
- data/spec/fixtures/partner.json +9 -0
- data/spec/fixtures/partners.json +11 -0
- data/spec/fixtures/section.json +9 -0
- data/spec/fixtures/sections.json +11 -0
- data/spec/fixtures/tag.json +9 -0
- data/spec/fixtures/tags.json +11 -0
- data/spec/fixtures/taxes.json +8 -0
- data/spec/fixtures/taxes_with_code.json +9 -0
- data/spec/fixtures/transfer.json +13 -0
- data/spec/fixtures/transfers.json +37 -0
- data/spec/fixtures/user.json +10 -0
- data/spec/fixtures/user_with_companies.json +19 -0
- data/spec/fixtures/wallet_txn.json +14 -0
- data/spec/fixtures/wallet_txns.json +16 -0
- data/spec/fixtures/walletable.json +1 -0
- data/spec/fixtures/walletables.json +9 -0
- data/spec/item_spec.rb +74 -21
- data/spec/partner_spec.rb +59 -21
- data/spec/section_spec.rb +68 -0
- data/spec/setenv_spec.rb +0 -4
- data/spec/spec_helper.rb +41 -3
- data/spec/tag_spec.rb +68 -0
- data/spec/tax_spec.rb +63 -22
- data/spec/transfer_spec.rb +89 -34
- data/spec/user_spec.rb +47 -20
- data/spec/util_spec.rb +19 -10
- data/spec/wallet_txn_spec.rb +88 -0
- data/spec/walletable_spec.rb +74 -24
- metadata +109 -15
- data/lib/freee/amount.rb +0 -7
- data/spec/account_spec.rb +0 -34
- data/spec/amount_spec.rb +0 -26
- data/spec/wallet_spec.rb +0 -89
data/spec/amount_spec.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Freee::Amount do
|
4
|
-
let(:client_id) { get_client_id }
|
5
|
-
let(:secret_key) { get_secret_key }
|
6
|
-
let(:token) { get_token }
|
7
|
-
let(:amount) { Freee::Amount }
|
8
|
-
|
9
|
-
before(:each) do
|
10
|
-
Freee::Base.config(client_id, secret_key, token)
|
11
|
-
end
|
12
|
-
|
13
|
-
describe 'should can be able to create instance' do
|
14
|
-
subject { amount.current_report }
|
15
|
-
it { is_expected.not_to be_nil }
|
16
|
-
it { is_expected.to be_instance_of(Freee::Response::Amount) }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe 'should be get information of amount by current' do
|
20
|
-
subject { amount.current_report }
|
21
|
-
|
22
|
-
it { is_expected.to include('company_id') }
|
23
|
-
it { is_expected.to include('start_date') }
|
24
|
-
it { is_expected.to include('end_date') }
|
25
|
-
end
|
26
|
-
end
|
data/spec/wallet_spec.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Freee::Wallet do
|
4
|
-
let(:client_id) { get_client_id }
|
5
|
-
let(:secret_key) { get_secret_key }
|
6
|
-
let(:token) { get_token }
|
7
|
-
let(:company_id) { get_company_id }
|
8
|
-
let(:walletable_id) { get_walletable_id }
|
9
|
-
let(:wallet) { Freee::Wallet }
|
10
|
-
let(:response) do
|
11
|
-
wallet.create(
|
12
|
-
company_id: company_id,
|
13
|
-
walletable_id: walletable_id,
|
14
|
-
date: '2014-07-10',
|
15
|
-
walletable_type: 'bank_account',
|
16
|
-
amount: '1000000',
|
17
|
-
entry_side: 'income'
|
18
|
-
)['wallet_txn']
|
19
|
-
end
|
20
|
-
|
21
|
-
before(:each) do
|
22
|
-
Freee::Base.config(client_id, secret_key, token)
|
23
|
-
end
|
24
|
-
|
25
|
-
describe 'should can be able to create instance' do
|
26
|
-
subject { wallet.list(company_id) }
|
27
|
-
it { is_expected.not_to be_nil }
|
28
|
-
it { is_expected.to be_instance_of(Freee::Response::Wallet) }
|
29
|
-
end
|
30
|
-
|
31
|
-
describe 'should get information of wallet txns for the company' do
|
32
|
-
subject { wallet.list(company_id) }
|
33
|
-
|
34
|
-
it { is_expected.to include('wallet_txns') }
|
35
|
-
end
|
36
|
-
|
37
|
-
describe 'should get information of first wallet txns for the company' do
|
38
|
-
subject { wallet.list(company_id)['wallet_txns'].first }
|
39
|
-
|
40
|
-
it { is_expected.not_to be_nil }
|
41
|
-
it { is_expected.to include('id') }
|
42
|
-
it { is_expected.to include('company_id') }
|
43
|
-
it { is_expected.to include('amount') }
|
44
|
-
it { is_expected.to include('balance') }
|
45
|
-
it { is_expected.to include('description') }
|
46
|
-
it { is_expected.to include('due_amount') }
|
47
|
-
it { is_expected.to include('date') }
|
48
|
-
it { is_expected.to include('entry_side') }
|
49
|
-
it { is_expected.to include('walletable_type') }
|
50
|
-
it { is_expected.to include('walletable_id') }
|
51
|
-
end
|
52
|
-
|
53
|
-
describe 'should get information of first wallet txns with walletable type' do
|
54
|
-
subject do
|
55
|
-
result = wallet.list(company_id, walletable_type: 'bank_account')['wallet_txns']
|
56
|
-
result.map! { |x| x['walletable_type'] }
|
57
|
-
Set.new(result).length
|
58
|
-
end
|
59
|
-
|
60
|
-
it { is_expected.not_to be_nil }
|
61
|
-
it { is_expected.to eq 1 }
|
62
|
-
end
|
63
|
-
|
64
|
-
describe "should get information of one's wallet txns" do
|
65
|
-
subject do
|
66
|
-
wallet.list(company_id, limit: 2)['wallet_txns'].length
|
67
|
-
end
|
68
|
-
|
69
|
-
it { is_expected.not_to be_nil }
|
70
|
-
it { is_expected.to eq 2 }
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should set information of one's wallet txns" do
|
74
|
-
expect(response).to include('id')
|
75
|
-
expect(response).to include('company_id')
|
76
|
-
expect(response).to include('walletable_id')
|
77
|
-
expect(response).to include('date')
|
78
|
-
expect(response).to include('walletable_type')
|
79
|
-
expect(response).to include('amount')
|
80
|
-
expect(response).to include('entry_side')
|
81
|
-
|
82
|
-
expect(response['company_id']).to eq company_id.to_i
|
83
|
-
expect(response['walletable_id']).to eq walletable_id.to_i
|
84
|
-
expect(response['date']).to eq '2014-07-10'
|
85
|
-
expect(response['walletable_type']).to eq 'bank_account'
|
86
|
-
expect(response['amount']).to eq 1000000
|
87
|
-
expect(response['entry_side']).to eq 'income'
|
88
|
-
end
|
89
|
-
end
|