freee 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/freee.gemspec +10 -10
- data/lib/freee.rb +13 -5
- data/lib/freee/account.rb +2 -2
- data/lib/freee/amount.rb +2 -2
- data/lib/freee/base.rb +6 -3
- data/lib/freee/company.rb +4 -4
- data/lib/freee/deal.rb +2 -2
- data/lib/freee/item.rb +2 -2
- data/lib/freee/partner.rb +3 -3
- data/lib/freee/tax.rb +4 -4
- data/lib/freee/transfer.rb +3 -3
- data/lib/freee/user.rb +4 -6
- data/lib/freee/util.rb +0 -2
- data/lib/freee/version.rb +1 -1
- data/lib/freee/wallet.rb +3 -3
- data/lib/freee/walletable.rb +2 -2
- data/spec/account_spec.rb +17 -7
- data/spec/amount_spec.rb +7 -6
- data/spec/company_spec.rb +25 -13
- data/spec/deal_spec.rb +47 -3
- data/spec/item_spec.rb +15 -3
- data/spec/partner_spec.rb +15 -3
- data/spec/spec_helper.rb +8 -4
- data/spec/tax_spec.rb +17 -2
- data/spec/transfer_spec.rb +23 -3
- data/spec/user_spec.rb +10 -9
- data/spec/wallet_spec.rb +26 -3
- data/spec/walletable_spec.rb +19 -2
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6fda07697ca360d914d84f8e5b967dd321b8959
|
4
|
+
data.tar.gz: ebbbb94596ca933d6cb75a628459a96a40ce4d6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0275a1c2f21e00d2726b5846691872209df4c6912b99c45787468bc227c3ee1362399e1909c26b533e7d2812d3013373928eaa16cd5fbb4bd11063db38ded2c9
|
7
|
+
data.tar.gz: bdce06175290a12354f348c1b71cd4e8a17ad0cc9643f3e6615e5f1b5a7d46bcc06c7e464ceb693061dec565ebc115e24faf8fb6986162a9e3a36db57619ed48
|
data/freee.gemspec
CHANGED
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = Freee::VERSION
|
9
9
|
spec.authors = ["Keiji Matsuzaki"]
|
10
10
|
spec.email = ["futoase@gmail.com"]
|
11
|
-
spec.summary = %q{
|
11
|
+
spec.summary = %q{freee API.}
|
12
12
|
spec.description = %q{Ruby implementation of the freee API.}
|
13
|
-
spec.homepage = ""
|
13
|
+
spec.homepage = "https://github.com/futoase/freee-gem"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
@@ -18,13 +18,13 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.
|
23
|
-
spec.
|
24
|
-
spec.
|
25
|
-
spec.
|
21
|
+
spec.add_runtime_dependency 'oauth2'
|
22
|
+
spec.add_runtime_dependency 'faraday'
|
23
|
+
spec.add_runtime_dependency 'faraday_middleware'
|
24
|
+
spec.add_runtime_dependency 'httpauth'
|
25
|
+
spec.add_runtime_dependency 'thor'
|
26
26
|
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
27
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
28
|
+
spec.add_development_dependency 'rake'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
30
|
end
|
data/lib/freee.rb
CHANGED
@@ -4,13 +4,21 @@ require 'faraday_middleware'
|
|
4
4
|
require 'httpauth'
|
5
5
|
require 'thor'
|
6
6
|
|
7
|
+
$:.unshift(File.dirname(__FILE__))
|
7
8
|
require 'freee/version'
|
8
9
|
require 'freee/base'
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
require 'freee/account'
|
11
|
+
require 'freee/amount'
|
12
|
+
require 'freee/company'
|
13
|
+
require 'freee/deal'
|
14
|
+
require 'freee/item'
|
15
|
+
require 'freee/partner'
|
16
|
+
require 'freee/tax'
|
17
|
+
require 'freee/transfer'
|
18
|
+
require 'freee/user'
|
19
|
+
require 'freee/util'
|
20
|
+
require 'freee/wallet'
|
21
|
+
require 'freee/walletable'
|
14
22
|
|
15
23
|
module Freee
|
16
24
|
OPTIONS = {
|
data/lib/freee/account.rb
CHANGED
data/lib/freee/amount.rb
CHANGED
data/lib/freee/base.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
require 'freee'
|
2
|
-
|
3
1
|
module Freee
|
2
|
+
|
3
|
+
def client
|
4
|
+
Base.new.client
|
5
|
+
end
|
6
|
+
module_function :client
|
7
|
+
|
4
8
|
class Base
|
5
9
|
|
6
10
|
@@client_id = nil
|
@@ -30,7 +34,6 @@ module Freee
|
|
30
34
|
@@token = token
|
31
35
|
end
|
32
36
|
|
33
|
-
|
34
37
|
def get(path)
|
35
38
|
@client.get(path).response.env[:body]
|
36
39
|
end
|
data/lib/freee/company.rb
CHANGED
@@ -4,12 +4,12 @@ module Freee
|
|
4
4
|
#client.post('/api/p/companies')
|
5
5
|
end
|
6
6
|
|
7
|
-
def list
|
8
|
-
client.get('/api/1/companies')
|
7
|
+
def self.list
|
8
|
+
Freee.client.get('/api/1/companies')
|
9
9
|
end
|
10
10
|
|
11
|
-
def list_of_details(company_id)
|
12
|
-
client.get("/api/1/companies/#{company_id.
|
11
|
+
def self.list_of_details(company_id)
|
12
|
+
Freee.client.get("/api/1/companies/#{company_id.to_s}")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/freee/deal.rb
CHANGED
data/lib/freee/item.rb
CHANGED
data/lib/freee/partner.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Freee
|
2
2
|
class Partner < Freee::Base
|
3
|
-
def create
|
3
|
+
def self.create
|
4
4
|
#client.post('/api//1/partners')
|
5
5
|
end
|
6
6
|
|
7
|
-
def list
|
8
|
-
client.get(
|
7
|
+
def self.list(company_id)
|
8
|
+
Freee.client.get("/api/1/partners?company_id=#{company_id.to_s}")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/freee/tax.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Freee
|
2
2
|
class Tax < Freee::Base
|
3
|
-
def list
|
4
|
-
client.get(
|
3
|
+
def self.list(company_id)
|
4
|
+
Freee.client.get("/api/1/taxes?company_id=#{company_id.to_s}")
|
5
5
|
end
|
6
6
|
|
7
|
-
def list_of_code
|
8
|
-
client.get('/api/1/taxes/codes')
|
7
|
+
def self.list_of_code
|
8
|
+
Freee.client.get('/api/1/taxes/codes')
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/freee/transfer.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Freee
|
2
2
|
class Transfer < Freee::Base
|
3
|
-
def create
|
3
|
+
def self.create
|
4
4
|
#client.post('/api/1/transfers')
|
5
5
|
end
|
6
6
|
|
7
|
-
def list
|
8
|
-
client.get(
|
7
|
+
def self.list(company_id)
|
8
|
+
Freee.client.get("/api/1/transfers?company_id=#{company_id}")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/freee/user.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
-
require 'freee'
|
2
|
-
|
3
1
|
module Freee
|
4
2
|
class User < Freee::Base
|
5
|
-
def me
|
6
|
-
client.get('/api/1/users/me')
|
3
|
+
def self.me
|
4
|
+
Freee.client.get('/api/1/users/me')
|
7
5
|
end
|
8
6
|
|
9
|
-
def me_all
|
10
|
-
client.get('/api/1/users/me?companies=true')
|
7
|
+
def self.me_all
|
8
|
+
Freee.client.get('/api/1/users/me?companies=true')
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
data/lib/freee/util.rb
CHANGED
data/lib/freee/version.rb
CHANGED
data/lib/freee/wallet.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module Freee
|
2
2
|
class Wallet < Freee::Base
|
3
|
-
def create
|
3
|
+
def self.create
|
4
4
|
#client.post('/api/1/wallet_txns')
|
5
5
|
end
|
6
6
|
|
7
|
-
def list
|
8
|
-
client.get(
|
7
|
+
def self.list(company_id)
|
8
|
+
Freee.client.get("/api/1/wallet_txns?company_id=#{company_id}")
|
9
9
|
end
|
10
10
|
end
|
11
11
|
end
|
data/lib/freee/walletable.rb
CHANGED
data/spec/account_spec.rb
CHANGED
@@ -1,23 +1,33 @@
|
|
1
|
-
|
1
|
+
require_relative 'spec_helper'
|
2
2
|
|
3
3
|
describe Freee::Account do
|
4
4
|
let(:client_id) { get_token }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:company_id) {
|
8
|
-
let(:account) { Freee::Account
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:account) { Freee::Account }
|
9
9
|
|
10
10
|
before(:each) do
|
11
11
|
Freee::Base.config(client_id, secret_key, token)
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should can be able to create instance' do
|
15
|
-
expect(account.items(company_id)).to
|
15
|
+
expect(account.items(company_id)).to include('account_items')
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
describe 'should be get information of account' do
|
19
|
+
subject { account.items(company_id) }
|
20
|
+
it { is_expected.to include('account_items') }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'should be get information of account_items' do
|
24
|
+
subject { account.items(company_id)['account_items'].first }
|
20
25
|
|
21
|
-
|
26
|
+
it { is_expected.not_to be_nil }
|
27
|
+
it { is_expected.to include('id') }
|
28
|
+
it { is_expected.to include('name') }
|
29
|
+
it { is_expected.to include('shortcut') }
|
30
|
+
it { is_expected.to include('default_tax_id') }
|
31
|
+
it { is_expected.to include('categories') }
|
22
32
|
end
|
23
33
|
end
|
data/spec/amount_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Freee::Amount do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:amount) { Freee::Amount
|
7
|
+
let(:amount) { Freee::Amount }
|
8
8
|
|
9
9
|
before(:each) do
|
10
10
|
Freee::Base.config(client_id, secret_key, token)
|
@@ -14,10 +14,11 @@ describe Freee::Amount do
|
|
14
14
|
expect(amount.current_report).not_to be_nil
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
describe 'should be get information of amount by current' do
|
18
|
+
subject { amount.current_report }
|
19
|
+
|
20
|
+
it { is_expected.to include('company_id') }
|
21
|
+
it { is_expected.to include('start_date') }
|
22
|
+
it { is_expected.to include('end_date') }
|
22
23
|
end
|
23
24
|
end
|
data/spec/company_spec.rb
CHANGED
@@ -4,28 +4,40 @@ describe Freee::Company do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:company_id) {
|
8
|
-
let(:company) { Freee::Company
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:company) { Freee::Company }
|
9
9
|
|
10
10
|
before(:each) do
|
11
|
-
Freee::Base.config(
|
11
|
+
Freee::Base.config(client_id, secret_key, token)
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should can be able to create instance' do
|
15
15
|
expect(company.list).not_to be_nil
|
16
16
|
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
describe 'should be get first list of company' do
|
19
|
+
subject { company.list["companies"].first }
|
20
|
+
|
21
|
+
it { is_expected.to include('id') }
|
22
|
+
it { is_expected.to include('name') }
|
23
|
+
it { is_expected.to include('name_kana') }
|
24
|
+
it { is_expected.to include('display_name') }
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
27
|
+
describe 'should be get item of the company' do
|
28
|
+
subject { company.list_of_details(company_id) }
|
29
|
+
|
30
|
+
it { is_expected.to include('company') }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe 'should be get information of item for the company' do
|
34
|
+
subject { company.list_of_details(company_id)['company'] }
|
35
|
+
|
36
|
+
it { is_expected.not_to be_nil }
|
37
|
+
it { is_expected.to include('id') }
|
38
|
+
it { is_expected.to include('name') }
|
39
|
+
it { is_expected.to include('name_kana') }
|
40
|
+
it { is_expected.to include('display_name') }
|
41
|
+
it { is_expected.to include('role') }
|
30
42
|
end
|
31
43
|
end
|
data/spec/deal_spec.rb
CHANGED
@@ -4,13 +4,57 @@ describe Freee::Deal do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:deal) { Freee::Deal }
|
8
9
|
|
9
10
|
before(:each) do
|
10
|
-
Freee::Base.config(
|
11
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should can be able to create instance' do
|
14
|
-
expect(deal.list).not_to be_nil
|
15
|
+
expect(deal.list(company_id)).not_to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'should get deals for the company' do
|
19
|
+
subject { deal.list(company_id) }
|
20
|
+
|
21
|
+
it { is_expected.to include('deals') }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'should get deal of first for the company' do
|
25
|
+
subject { deal.list(company_id)['deals'].first }
|
26
|
+
|
27
|
+
it { is_expected.not_to be_nil }
|
28
|
+
it { is_expected.to include('id') }
|
29
|
+
it { is_expected.to include('company_id') }
|
30
|
+
it { is_expected.to include('issue_date') }
|
31
|
+
it { is_expected.to include('due_date') }
|
32
|
+
it { is_expected.to include('amount') }
|
33
|
+
it { is_expected.to include('due_amount') }
|
34
|
+
it { is_expected.to include('type') }
|
35
|
+
it { is_expected.to include('partner_id') }
|
36
|
+
it { is_expected.to include('details') }
|
37
|
+
it { is_expected.to include('payments') }
|
38
|
+
end
|
39
|
+
|
40
|
+
describe 'should get details from deals for the company' do
|
41
|
+
subject { deal.list(company_id)['deals'].first['details'].first }
|
42
|
+
|
43
|
+
it { is_expected.not_to be_nil }
|
44
|
+
it { is_expected.to include('account_item_id') }
|
45
|
+
it { is_expected.to include('tax_id') }
|
46
|
+
it { is_expected.to include('item_id') }
|
47
|
+
it { is_expected.to include('amount') }
|
48
|
+
it { is_expected.to include('description') }
|
49
|
+
end
|
50
|
+
|
51
|
+
describe 'should get payments from deals for the company' do
|
52
|
+
subject { deal.list(company_id)['deals'].first['payments'].first }
|
53
|
+
|
54
|
+
it { is_expected.not_to be_nil }
|
55
|
+
it { is_expected.to include('date') }
|
56
|
+
it { is_expected.to include('from_walletable_type') }
|
57
|
+
it { is_expected.to include('from_walletable_id') }
|
58
|
+
it { is_expected.to include('amount') }
|
15
59
|
end
|
16
60
|
end
|
data/spec/item_spec.rb
CHANGED
@@ -4,13 +4,25 @@ describe Freee::Item do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:item) { Freee::Item }
|
8
9
|
|
9
10
|
before(:each) do
|
10
|
-
Freee::Base.config(
|
11
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should can be able to create instance' do
|
14
|
-
expect(item.list).
|
15
|
+
expect(item.list(company_id)).not_to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'should get information of first item for the company' do
|
19
|
+
subject { item.list(company_id)['items'].first }
|
20
|
+
|
21
|
+
it { is_expected.not_to be_nil }
|
22
|
+
it { is_expected.to include('id') }
|
23
|
+
it { is_expected.to include('company_id') }
|
24
|
+
it { is_expected.to include('name') }
|
25
|
+
it { is_expected.to include('shortcut1') }
|
26
|
+
it { is_expected.to include('shortcut2') }
|
15
27
|
end
|
16
28
|
end
|
data/spec/partner_spec.rb
CHANGED
@@ -4,13 +4,25 @@ describe Freee::Partner do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:partner) { Freee::Partner }
|
8
9
|
|
9
10
|
before(:each) do
|
10
|
-
Freee::Base.config(
|
11
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should can be able to create instance' do
|
14
|
-
expect(partner.list).not_to be_nil
|
15
|
+
expect(partner.list(company_id)).not_to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'should get partners of first item for the company' do
|
19
|
+
subject { partner.list(company_id)['partners'].first }
|
20
|
+
|
21
|
+
it { is_expected.not_to be_nil }
|
22
|
+
it { is_expected.to include('id') }
|
23
|
+
it { is_expected.to include('company_id') }
|
24
|
+
it { is_expected.to include('name') }
|
25
|
+
it { is_expected.to include('shortcut1') }
|
26
|
+
it { is_expected.to include('shortcut2') }
|
15
27
|
end
|
16
28
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
$:.unshift(File.realpath(File.dirname(__FILE__) + '/../lib'))
|
2
2
|
|
3
|
-
require 'freee
|
3
|
+
require 'freee'
|
4
4
|
|
5
|
-
Dir.glob(File.realpath(File.dirname(__FILE__) + '/../lib/freee') + '/**') do |freee|
|
6
|
-
require freee
|
7
|
-
end
|
5
|
+
#Dir.glob(File.realpath(File.dirname(__FILE__) + '/../lib/freee') + '/**') do |freee|
|
6
|
+
# require freee
|
7
|
+
#end
|
8
8
|
|
9
9
|
SAMPLE = YAML.load_file(File.expand_path('./sample.yml', __dir__))
|
10
10
|
|
@@ -28,6 +28,10 @@ def get_authorization_code
|
|
28
28
|
SAMPLE["get_authorization_code"]
|
29
29
|
end
|
30
30
|
|
31
|
+
def get_company_id
|
32
|
+
SAMPLE["company_id"]
|
33
|
+
end
|
34
|
+
|
31
35
|
RSpec.configure do |config|
|
32
36
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
33
37
|
config.run_all_when_everything_filtered = true
|
data/spec/tax_spec.rb
CHANGED
@@ -4,13 +4,28 @@ describe Freee::Tax do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:tax) { Freee::Tax }
|
8
9
|
|
9
10
|
before(:each) do
|
10
11
|
Freee::Base.config(client_id, secret_key, token)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should can be able to create instance' do
|
14
|
-
expect(tax.list).
|
15
|
+
expect(tax.list(company_id)).not_to be_nil
|
15
16
|
end
|
17
|
+
|
18
|
+
describe 'should get item of tax for the company' do
|
19
|
+
subject { tax.list(company_id) }
|
20
|
+
|
21
|
+
it { is_expected.to include('taxes') }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'should get item of first tax for the company' do
|
25
|
+
subject { tax.list(company_id)['taxes'].first }
|
26
|
+
|
27
|
+
it { is_expected.to include('id') }
|
28
|
+
it { is_expected.to include('name') }
|
29
|
+
end
|
30
|
+
|
16
31
|
end
|
data/spec/transfer_spec.rb
CHANGED
@@ -4,13 +4,33 @@ describe Freee::Transfer do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:transfer) { Freee::Transfer }
|
8
9
|
|
9
10
|
before(:each) do
|
10
|
-
Freee::Base.config(
|
11
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should be able to get client' do
|
14
|
-
expect(transfer.list).not_to be_nil
|
15
|
+
expect(transfer.list(company_id)).not_to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should be get information of transfers for the company' do
|
19
|
+
expect(transfer.list(company_id)).to include('transfers')
|
20
|
+
end
|
21
|
+
|
22
|
+
describe 'should be get information of first transfers for the company' do
|
23
|
+
subject { transfer.list(company_id)['transfers'].first }
|
24
|
+
|
25
|
+
it { is_expected.not_to be_nil }
|
26
|
+
it { is_expected.to include('id') }
|
27
|
+
it { is_expected.to include('company_id') }
|
28
|
+
it { is_expected.to include('date') }
|
29
|
+
it { is_expected.to include('amount') }
|
30
|
+
it { is_expected.to include('from_walletable_id') }
|
31
|
+
it { is_expected.to include('from_walletable_type') }
|
32
|
+
it { is_expected.to include('to_walletable_type') }
|
33
|
+
it { is_expected.to include('to_walletable_id') }
|
34
|
+
it { is_expected.to include('description') }
|
15
35
|
end
|
16
36
|
end
|
data/spec/user_spec.rb
CHANGED
@@ -4,25 +4,26 @@ describe Freee::User do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:user) { Freee::User
|
7
|
+
let(:user) { Freee::User }
|
8
8
|
|
9
9
|
before(:each) do
|
10
10
|
Freee::Base.config(client_id, secret_key, token)
|
11
11
|
end
|
12
12
|
|
13
|
-
it 'should can be able to create instance' do
|
14
|
-
expect(user.client).not_to be_nil
|
15
|
-
end
|
16
|
-
|
17
13
|
it 'should be get information of user' do
|
18
14
|
result = user.me
|
19
|
-
expect(result).to include(
|
20
|
-
expect(result[
|
15
|
+
expect(result).to include('user')
|
16
|
+
expect(result['user']).not_to include('companies')
|
21
17
|
end
|
22
18
|
|
23
19
|
it 'should be get information of user at all' do
|
24
20
|
result = user.me_all
|
25
|
-
expect(result).to include(
|
26
|
-
expect(result[
|
21
|
+
expect(result).to include('user')
|
22
|
+
expect(result['user']).to include('companies')
|
23
|
+
user_company_info_of_first = result['user']['companies'].first
|
24
|
+
|
25
|
+
expect(user_company_info_of_first).to include('id')
|
26
|
+
expect(user_company_info_of_first).to include('display_name')
|
27
|
+
expect(user_company_info_of_first).to include('role')
|
27
28
|
end
|
28
29
|
end
|
data/spec/wallet_spec.rb
CHANGED
@@ -4,13 +4,36 @@ describe Freee::Wallet do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:wallet) { Freee::Wallet }
|
8
9
|
|
9
10
|
before(:each) do
|
10
|
-
Freee::Base.config(
|
11
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should can be able to create instance' do
|
14
|
-
expect(wallet.list).not_to be_nil
|
15
|
+
expect(wallet.list(company_id)).not_to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'should get information of wallet txns for the company' do
|
19
|
+
subject { wallet.list(company_id) }
|
20
|
+
|
21
|
+
it { is_expected.to include('wallet_txns') }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe 'should get information of first wallet txns for the company' do
|
25
|
+
subject { wallet.list(company_id)['wallet_txns'].first }
|
26
|
+
|
27
|
+
it { is_expected.not_to be_nil }
|
28
|
+
it { is_expected.to include('id') }
|
29
|
+
it { is_expected.to include('company_id') }
|
30
|
+
it { is_expected.to include('amount') }
|
31
|
+
it { is_expected.to include('balance') }
|
32
|
+
it { is_expected.to include('description') }
|
33
|
+
it { is_expected.to include('due_amount') }
|
34
|
+
it { is_expected.to include('date') }
|
35
|
+
it { is_expected.to include('entry_side') }
|
36
|
+
it { is_expected.to include('walletable_type') }
|
37
|
+
it { is_expected.to include('walletable_id') }
|
15
38
|
end
|
16
39
|
end
|
data/spec/walletable_spec.rb
CHANGED
@@ -4,13 +4,30 @@ describe Freee::Walletable do
|
|
4
4
|
let(:client_id) { get_client_id }
|
5
5
|
let(:secret_key) { get_secret_key }
|
6
6
|
let(:token) { get_token }
|
7
|
-
let(:
|
7
|
+
let(:company_id) { get_company_id }
|
8
|
+
let(:walletable) { Freee::Walletable }
|
8
9
|
|
9
10
|
before(:each) do
|
10
11
|
Freee::Base.config(client_id, secret_key, token)
|
11
12
|
end
|
12
13
|
|
13
14
|
it 'should can be able to create instance' do
|
14
|
-
expect(walletable.list).not_to be_nil
|
15
|
+
expect(walletable.list(company_id)).not_to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'should get information of walletable for the company' do
|
19
|
+
subject { walletable.list(company_id) }
|
20
|
+
|
21
|
+
it { is_expected.not_to be_nil }
|
22
|
+
it { is_expected.to include('walletables') }
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'should get information of first walletable for the company' do
|
26
|
+
subject { walletable.list(company_id)['walletables'].first }
|
27
|
+
|
28
|
+
it { is_expected.not_to be_nil }
|
29
|
+
it { is_expected.to include('id') }
|
30
|
+
it { is_expected.to include('name') }
|
31
|
+
it { is_expected.to include('type') }
|
15
32
|
end
|
16
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiji Matsuzaki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oauth2
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
117
|
+
version: '3.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
124
|
+
version: '3.0'
|
125
125
|
description: Ruby implementation of the freee API.
|
126
126
|
email:
|
127
127
|
- futoase@gmail.com
|
@@ -168,7 +168,7 @@ files:
|
|
168
168
|
- spec/util_spec.rb
|
169
169
|
- spec/wallet_spec.rb
|
170
170
|
- spec/walletable_spec.rb
|
171
|
-
homepage:
|
171
|
+
homepage: https://github.com/futoase/freee-gem
|
172
172
|
licenses:
|
173
173
|
- MIT
|
174
174
|
metadata: {}
|
@@ -191,7 +191,7 @@ rubyforge_project:
|
|
191
191
|
rubygems_version: 2.2.2
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
|
-
summary:
|
194
|
+
summary: freee API.
|
195
195
|
test_files:
|
196
196
|
- spec/account_spec.rb
|
197
197
|
- spec/amount_spec.rb
|