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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d9fa495f32e128662402a0a6470045e56f66a24
4
- data.tar.gz: e1b07621fa88214885d162ded3d6329dec23431f
3
+ metadata.gz: b6fda07697ca360d914d84f8e5b967dd321b8959
4
+ data.tar.gz: ebbbb94596ca933d6cb75a628459a96a40ce4d6b
5
5
  SHA512:
6
- metadata.gz: 9249688a8787a1872daa1497d8cf104057ec7dd093eca0e8f4b70bdeeb99403ae47230a1209457061e0afdd16dd18cd557192595dbcdeef98de56a3ed4b5c1f6
7
- data.tar.gz: 57f3256878d05178bad5b6292f6986daf05d374059406dbc8306099085c83834d12ae4fcf762fbda8da9faed564e3505ce1eae95782e26a9f8616f3175dfc669
6
+ metadata.gz: 0275a1c2f21e00d2726b5846691872209df4c6912b99c45787468bc227c3ee1362399e1909c26b533e7d2812d3013373928eaa16cd5fbb4bd11063db38ded2c9
7
+ data.tar.gz: bdce06175290a12354f348c1b71cd4e8a17ad0cc9643f3e6615e5f1b5a7d46bcc06c7e464ceb693061dec565ebc115e24faf8fb6986162a9e3a36db57619ed48
@@ -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{Ruby implementation of the freee API.}
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.add_dependency "oauth2"
22
- spec.add_dependency "faraday"
23
- spec.add_dependency "faraday_middleware"
24
- spec.add_dependency "httpauth"
25
- spec.add_dependency "thor"
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 "bundler", "~> 1.6"
28
- spec.add_development_dependency "rake"
29
- spec.add_development_dependency "rspec"
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
@@ -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
- path = File.dirname(File.absolute_path(__FILE__))
11
- Dir.glob(path + '/freee/*').each do |d|
12
- require d if FileTest.file?(d)
13
- end
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 = {
@@ -1,7 +1,7 @@
1
1
  module Freee
2
2
  class Account < Freee::Base
3
- def items(company_id)
4
- client.get("/api/1/account_items?company_id=#{company_id.to_i}")
3
+ def self.items(company_id)
4
+ Freee.client.get("/api/1/account_items?company_id=#{company_id.to_i}")
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Freee
2
2
  class Amount < Freee::Base
3
- def current_report
4
- client.get('/api/p/reports/amounts/current')
3
+ def self.current_report
4
+ Freee.client.get('/api/p/reports/amounts/current')
5
5
  end
6
6
  end
7
7
  end
@@ -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
@@ -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.to_i}")
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
@@ -4,8 +4,8 @@ module Freee
4
4
  #client.post('/api//1/deals')
5
5
  end
6
6
 
7
- def list
8
- client.get('/api/1/deals')
7
+ def self.list(company_id)
8
+ Freee.client.get("/api/1/deals?company_id=#{company_id.to_s}")
9
9
  end
10
10
  end
11
11
  end
@@ -4,8 +4,8 @@ module Freee
4
4
  #client.post('/api/1/items')
5
5
  end
6
6
 
7
- def list
8
- client.get('/api/1/items')
7
+ def self.list(company_id)
8
+ Freee.client.get("/api/1/items?company_id=#{company_id.to_s}")
9
9
  end
10
10
  end
11
11
  end
@@ -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('/api/1/partners')
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
@@ -1,11 +1,11 @@
1
1
  module Freee
2
2
  class Tax < Freee::Base
3
- def list
4
- client.get('/api/1/taxes')
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
@@ -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('/api/1/transfers')
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
@@ -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
@@ -1,5 +1,3 @@
1
- require 'freee'
2
-
3
1
  module Freee
4
2
  module Util
5
3
  def self.create_token(**kwarg)
@@ -1,3 +1,3 @@
1
1
  module Freee
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -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('/api/1/wallet_txns')
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
@@ -1,7 +1,7 @@
1
1
  module Freee
2
2
  class Walletable < Freee::Base
3
- def list
4
- client.get('/api/1/walletables')
3
+ def self.list(company_id)
4
+ Freee.client.get("/api/1/walletables?company_id=#{company_id}")
5
5
  end
6
6
  end
7
7
  end
@@ -1,23 +1,33 @@
1
- require 'spec_helper'
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) { '12345' }
8
- let(:account) { Freee::Account.new }
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 be_nil
15
+ expect(account.items(company_id)).to include('account_items')
16
16
  end
17
17
 
18
- it 'should be get information of account' do
19
- result = account.items(company_id)
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
- expect(result).to include("account_items")
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
@@ -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.new }
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
- it 'should be get information of amount by current' do
18
- result = amount.current_report
19
- expect(result).to include("company_id")
20
- expect(result).to include("start_date")
21
- expect(result).to include("end_date")
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
@@ -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) { '12345' }
8
- let(:company) { Freee::Company.new }
7
+ let(:company_id) { get_company_id }
8
+ let(:company) { Freee::Company }
9
9
 
10
10
  before(:each) do
11
- Freee::Base.config(config_id, secret_key)
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
- it 'should be get list of company' do
19
- result = company.list
20
- expect(result).to include("companies")
21
- expect(result.first).to include("id")
22
- expect(result.first).to include("name")
23
- expect(result.first).to include("name_kana")
24
- expect(result.first).to include("display_name")
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
- it 'should be get item of the company' do
28
- result = company.list_of_details(company_id)
29
- expect(result).to include("companies")
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
@@ -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(:deal) { Freee::Deal.new }
7
+ let(:company_id) { get_company_id }
8
+ let(:deal) { Freee::Deal }
8
9
 
9
10
  before(:each) do
10
- Freee::Base.config(config_id, secret_key, token)
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
@@ -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(:item) { Freee::Item.new }
7
+ let(:company_id) { get_company_id }
8
+ let(:item) { Freee::Item }
8
9
 
9
10
  before(:each) do
10
- Freee::Base.config(config_id, secret_key, token)
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).to be_nil
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
@@ -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(:partner) { Freee::Partner.new }
7
+ let(:company_id) { get_company_id }
8
+ let(:partner) { Freee::Partner }
8
9
 
9
10
  before(:each) do
10
- Freee::Base.config(config_id, secret_key)
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
@@ -1,10 +1,10 @@
1
1
  $:.unshift(File.realpath(File.dirname(__FILE__) + '/../lib'))
2
2
 
3
- require 'freee/base'
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
@@ -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(:tax) { Freee::Tax.new }
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).to be_nil
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
@@ -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(:transfer) { Freee::Transfer.new }
7
+ let(:company_id) { get_company_id }
8
+ let(:transfer) { Freee::Transfer }
8
9
 
9
10
  before(:each) do
10
- Freee::Base.config(config_id, secret_key, token)
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
@@ -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.new }
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("user")
20
- expect(result["user"]).not_to include("companies")
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("user")
26
- expect(result["user"]).to include("companies")
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
@@ -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(:wallet) { Freee::Wallet.new }
7
+ let(:company_id) { get_company_id }
8
+ let(:wallet) { Freee::Wallet }
8
9
 
9
10
  before(:each) do
10
- Freee::Base.config(config_id, secret_key, token)
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
@@ -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(:walletable) { Freee::Walletable.new }
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.2
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-15 00:00:00.000000000 Z
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: Ruby implementation of the freee API.
194
+ summary: freee API.
195
195
  test_files:
196
196
  - spec/account_spec.rb
197
197
  - spec/amount_spec.rb