freee 0.0.1
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 +7 -0
- data/.gitignore +23 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +2 -0
- data/bin/freee +50 -0
- data/freee.gemspec +30 -0
- data/lib/freee.rb +16 -0
- data/lib/freee/account.rb +7 -0
- data/lib/freee/amount.rb +7 -0
- data/lib/freee/base.rb +48 -0
- data/lib/freee/company.rb +15 -0
- data/lib/freee/deal.rb +11 -0
- data/lib/freee/item.rb +11 -0
- data/lib/freee/partner.rb +11 -0
- data/lib/freee/tax.rb +11 -0
- data/lib/freee/transfer.rb +11 -0
- data/lib/freee/user.rb +13 -0
- data/lib/freee/util.rb +34 -0
- data/lib/freee/version.rb +3 -0
- data/lib/freee/wallet.rb +11 -0
- data/lib/freee/walletable.rb +7 -0
- data/spec/account_spec.rb +23 -0
- data/spec/amount_spec.rb +23 -0
- data/spec/base_spec.rb +20 -0
- data/spec/company_spec.rb +31 -0
- data/spec/deal_spec.rb +16 -0
- data/spec/item_spec.rb +16 -0
- data/spec/partner_spec.rb +16 -0
- data/spec/sample.yml +6 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/tax_spec.rb +16 -0
- data/spec/transfer_spec.rb +16 -0
- data/spec/user_spec.rb +28 -0
- data/spec/util_spec.rb +20 -0
- data/spec/wallet_spec.rb +16 -0
- data/spec/walletable_spec.rb +16 -0
- metadata +210 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: db1404121825302407b5fbe40c83e8f24c02eaf8
|
4
|
+
data.tar.gz: 06e0a7185869885f908629ebf87bd5d15129bba9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f5d50a590cc0418f829bcc92024a8c5832176fbdae3ae1228c6154e0ed613ce49198024bdf3fdc02625daee51eb79dbca820023ae273837b03243c1f52fb13ea
|
7
|
+
data.tar.gz: b4f390f389c0159e45d4471fe9b474108ebf6507e48741490ed5e4e623b045a2428afe1d689a0270421a569ed839118f875b909631fd9aaa2897b1c50b81af40
|
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
vendor/*
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Keiji Matsuzaki
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Freee
|
2
|
+
|
3
|
+
Ruby implementation of the freee API.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'freee'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install freee
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
require 'freee'
|
23
|
+
|
24
|
+
Freee::Base.config("#{client_id}", "#{secret_key}", "#{token}")
|
25
|
+
Freee::User.new.me
|
26
|
+
```
|
27
|
+
|
28
|
+
### Create token
|
29
|
+
|
30
|
+
```
|
31
|
+
> freee token
|
32
|
+
```
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it ( https://github.com/futoase/freee/fork )
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/bin/freee
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# -*- coding:utf-8 -*-
|
3
|
+
|
4
|
+
require 'freee'
|
5
|
+
|
6
|
+
module Freee
|
7
|
+
class CLI < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
desc "token", "Get access token of application for the freee."
|
11
|
+
def token
|
12
|
+
client_id = ask("Client ID\n")
|
13
|
+
secret_key = ask("Secret Key\n")
|
14
|
+
redirect_uri = ask("Redirect URI\n")
|
15
|
+
authorization_code = ask("Authorization code\n")
|
16
|
+
|
17
|
+
options = {
|
18
|
+
site: 'https://api.freee.co.jp',
|
19
|
+
authorize_url: '/oauth/authorize',
|
20
|
+
token_url: '/oauth/token'
|
21
|
+
}
|
22
|
+
|
23
|
+
params = {
|
24
|
+
grant_type: 'authorization_code',
|
25
|
+
code: authorization_code.to_s,
|
26
|
+
redirect_uri: redirect_uri.to_s,
|
27
|
+
headers: {
|
28
|
+
'Content-Type' => 'application/json',
|
29
|
+
'Authorization' => HTTPAuth::Basic.pack_authorization(
|
30
|
+
client_id.to_s,
|
31
|
+
secret_key.to_s
|
32
|
+
)
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
client = OAuth2::Client.new(client_id, secret_key, options) do |con|
|
37
|
+
con.request :url_encoded
|
38
|
+
con.request :json
|
39
|
+
con.response :json, content_type: /\bjson$/
|
40
|
+
con.adapter Faraday.default_adapter
|
41
|
+
end
|
42
|
+
|
43
|
+
say("Token: #{client.get_token(params).token}")
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
Freee::CLI.start(ARGV)
|
49
|
+
|
50
|
+
#/* vim: set syntax=ruby */
|
data/freee.gemspec
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'freee/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "freee"
|
8
|
+
spec.version = Freee::VERSION
|
9
|
+
spec.authors = ["Keiji Matsuzaki"]
|
10
|
+
spec.email = ["futoase@gmail.com"]
|
11
|
+
spec.summary = %q{Ruby implementation of the freee API.}
|
12
|
+
spec.description = %q{Ruby implementation of the freee API.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
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"
|
26
|
+
|
27
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
28
|
+
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "rspec"
|
30
|
+
end
|
data/lib/freee.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'freee/version'
|
2
|
+
require 'oauth2'
|
3
|
+
require 'faraday'
|
4
|
+
require 'faraday_middleware'
|
5
|
+
require 'httpauth'
|
6
|
+
require 'thor'
|
7
|
+
|
8
|
+
$:.unshift(File.dirname(__FILE__))
|
9
|
+
|
10
|
+
module Freee
|
11
|
+
OPTIONS = {
|
12
|
+
site: 'https://api.freee.co.jp',
|
13
|
+
authorize_url: '/oauth/authorize',
|
14
|
+
token_url: '/oauth/token'
|
15
|
+
}
|
16
|
+
end
|
data/lib/freee/amount.rb
ADDED
data/lib/freee/base.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'freee'
|
2
|
+
|
3
|
+
module Freee
|
4
|
+
class Base
|
5
|
+
|
6
|
+
@@client_id = nil
|
7
|
+
@@secret_key = nil
|
8
|
+
@@token = nil
|
9
|
+
|
10
|
+
attr_reader :client
|
11
|
+
|
12
|
+
def self.config(client_id, secret_key, token)
|
13
|
+
@@client_id = client_id.to_s
|
14
|
+
@@secret_key = secret_key.to_s
|
15
|
+
@@token = token.to_s
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize; end
|
19
|
+
|
20
|
+
def client
|
21
|
+
@client = OAuth2::AccessToken.new(create_client, @@token)
|
22
|
+
self
|
23
|
+
end
|
24
|
+
|
25
|
+
def token
|
26
|
+
@@token
|
27
|
+
end
|
28
|
+
|
29
|
+
def token=(token)
|
30
|
+
@@token = token
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def get(path)
|
35
|
+
@client.get(path).response.env[:body]
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def create_client
|
40
|
+
OAuth2::Client.new(@@client_id, @@secret_key, OPTIONS) do |con|
|
41
|
+
con.request :url_encoded
|
42
|
+
con.request :json
|
43
|
+
con.response :json, content_type: /\bjson$/
|
44
|
+
con.adapter Faraday.default_adapter
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Freee
|
2
|
+
class Company < Freee::Base
|
3
|
+
def create
|
4
|
+
#client.post('/api/p/companies')
|
5
|
+
end
|
6
|
+
|
7
|
+
def list
|
8
|
+
client.get('/api/1/companies')
|
9
|
+
end
|
10
|
+
|
11
|
+
def list_of_details(company_id)
|
12
|
+
client.get("/api/1/companies/#{company_id.to_i}")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/freee/deal.rb
ADDED
data/lib/freee/item.rb
ADDED
data/lib/freee/tax.rb
ADDED
data/lib/freee/user.rb
ADDED
data/lib/freee/util.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'freee'
|
2
|
+
|
3
|
+
module Freee
|
4
|
+
module Util
|
5
|
+
def self.create_token(**kwarg)
|
6
|
+
|
7
|
+
client_id = kwarg[:client_id]
|
8
|
+
secret_key = kwarg[:secret_key]
|
9
|
+
client = OAuth2::Client.new(client_id, secret_key, OPTIONS) do |con|
|
10
|
+
con.request :url_encoded
|
11
|
+
con.request :json
|
12
|
+
con.response :json, content_type: /\bjson$/
|
13
|
+
con.adapter Faraday.default_adapter
|
14
|
+
end
|
15
|
+
|
16
|
+
params = {
|
17
|
+
grant_type: 'authorization_code',
|
18
|
+
code: kwarg[:authorization_code],
|
19
|
+
redirect_uri: kwarg[:redirect_url],
|
20
|
+
headers: {
|
21
|
+
'Content-Type' => 'application/json',
|
22
|
+
'Authorization' => HTTPAuth::Basic.pack_authorization(
|
23
|
+
client_id,
|
24
|
+
secret_key
|
25
|
+
)
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
client.get_token(params).token
|
30
|
+
end
|
31
|
+
|
32
|
+
extend self
|
33
|
+
end
|
34
|
+
end
|
data/lib/freee/wallet.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Account do
|
4
|
+
let(:client_id) { get_token }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:company_id) { '12345' }
|
8
|
+
let(:account) { Freee::Account.new }
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
Freee::Base.config(client_id, secret_key, token)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should can be able to create instance' do
|
15
|
+
expect(account.items(company_id)).to be_nil
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should be get information of account' do
|
19
|
+
result = account.items(company_id)
|
20
|
+
|
21
|
+
expect(result).to include("account_items")
|
22
|
+
end
|
23
|
+
end
|
data/spec/amount_spec.rb
ADDED
@@ -0,0 +1,23 @@
|
|
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.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should can be able to create instance' do
|
14
|
+
expect(amount.current_report).not_to be_nil
|
15
|
+
end
|
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")
|
22
|
+
end
|
23
|
+
end
|
data/spec/base_spec.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Base do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:freee) { Freee::Base.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should be able to get client' do
|
14
|
+
expect(freee.client).not_to be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should be call of get by Freee' do
|
18
|
+
expect(freee.client.get('/api/1/users/me?companies=true')).to include("user")
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Company do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:company_id) { '12345' }
|
8
|
+
let(:company) { Freee::Company.new }
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
Freee::Base.config(config_id, secret_key)
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should can be able to create instance' do
|
15
|
+
expect(company.list).not_to be_nil
|
16
|
+
end
|
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")
|
25
|
+
end
|
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")
|
30
|
+
end
|
31
|
+
end
|
data/spec/deal_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Deal do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:deal) { Freee::Deal.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(config_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should can be able to create instance' do
|
14
|
+
expect(deal.list).not_to be_nil
|
15
|
+
end
|
16
|
+
end
|
data/spec/item_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Item do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:item) { Freee::Item.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(config_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should can be able to create instance' do
|
14
|
+
expect(item.list).to be_nil
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Partner do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:partner) { Freee::Partner.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(config_id, secret_key)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should can be able to create instance' do
|
14
|
+
expect(partner.list).not_to be_nil
|
15
|
+
end
|
16
|
+
end
|
data/spec/sample.yml
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
$:.unshift(File.realpath(File.dirname(__FILE__) + '/../lib'))
|
2
|
+
|
3
|
+
require 'freee/base'
|
4
|
+
|
5
|
+
Dir.glob(File.realpath(File.dirname(__FILE__) + '/../lib/freee') + '/**') do |freee|
|
6
|
+
require freee
|
7
|
+
end
|
8
|
+
|
9
|
+
SAMPLE = YAML.load_file(File.expand_path('./sample.yml', __dir__))
|
10
|
+
|
11
|
+
def get_client_id
|
12
|
+
SAMPLE["client_id"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def get_secret_key
|
16
|
+
SAMPLE["secret_key"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_token
|
20
|
+
SAMPLE["token"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_redirect_url
|
24
|
+
SAMPLE["redirect_url"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_authorization_code
|
28
|
+
SAMPLE["get_authorization_code"]
|
29
|
+
end
|
30
|
+
|
31
|
+
RSpec.configure do |config|
|
32
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
33
|
+
config.run_all_when_everything_filtered = true
|
34
|
+
config.filter_run :focus
|
35
|
+
config.order = 'random'
|
36
|
+
end
|
data/spec/tax_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Tax do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:tax) { Freee::Tax.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should can be able to create instance' do
|
14
|
+
expect(tax.list).to be_nil
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Transfer do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:transfer) { Freee::Transfer.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(config_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should be able to get client' do
|
14
|
+
expect(transfer.list).not_to be_nil
|
15
|
+
end
|
16
|
+
end
|
data/spec/user_spec.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::User do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:user) { Freee::User.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should can be able to create instance' do
|
14
|
+
expect(user.client).not_to be_nil
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'should be get information of user' do
|
18
|
+
result = user.me
|
19
|
+
expect(result).to include("user")
|
20
|
+
expect(result["user"]).not_to include("companies")
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should be get information of user at all' do
|
24
|
+
result = user.me_all
|
25
|
+
expect(result).to include("user")
|
26
|
+
expect(result["user"]).to include("companies")
|
27
|
+
end
|
28
|
+
end
|
data/spec/util_spec.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Util do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:redirect_url) { get_redirect_url }
|
7
|
+
let(:authorization_code) { get_authorization_code }
|
8
|
+
let(:token) { get_token }
|
9
|
+
|
10
|
+
it 'should be get access token' do
|
11
|
+
result = Freee::Util.create_token(
|
12
|
+
client_id: client_id,
|
13
|
+
secret_key: secret_key,
|
14
|
+
redirect_url: redirect_url,
|
15
|
+
authorization_code: authorization_code
|
16
|
+
)
|
17
|
+
expect(result).to be_kind_of(String)
|
18
|
+
expect(result).to match(/[a-z0-9]{64}/)
|
19
|
+
end
|
20
|
+
end
|
data/spec/wallet_spec.rb
ADDED
@@ -0,0 +1,16 @@
|
|
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(:wallet) { Freee::Wallet.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(config_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should can be able to create instance' do
|
14
|
+
expect(wallet.list).not_to be_nil
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Freee::Walletable do
|
4
|
+
let(:client_id) { get_client_id }
|
5
|
+
let(:secret_key) { get_secret_key }
|
6
|
+
let(:token) { get_token }
|
7
|
+
let(:walletable) { Freee::Walletable.new }
|
8
|
+
|
9
|
+
before(:each) do
|
10
|
+
Freee::Base.config(client_id, secret_key, token)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should can be able to create instance' do
|
14
|
+
expect(walletable.list).not_to be_nil
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,210 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: freee
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Keiji Matsuzaki
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-06-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: oauth2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday_middleware
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: httpauth
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.6'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Ruby implementation of the freee API.
|
126
|
+
email:
|
127
|
+
- futoase@gmail.com
|
128
|
+
executables:
|
129
|
+
- freee
|
130
|
+
extensions: []
|
131
|
+
extra_rdoc_files: []
|
132
|
+
files:
|
133
|
+
- ".gitignore"
|
134
|
+
- ".rspec"
|
135
|
+
- Gemfile
|
136
|
+
- LICENSE.txt
|
137
|
+
- README.md
|
138
|
+
- Rakefile
|
139
|
+
- bin/freee
|
140
|
+
- freee.gemspec
|
141
|
+
- lib/freee.rb
|
142
|
+
- lib/freee/account.rb
|
143
|
+
- lib/freee/amount.rb
|
144
|
+
- lib/freee/base.rb
|
145
|
+
- lib/freee/company.rb
|
146
|
+
- lib/freee/deal.rb
|
147
|
+
- lib/freee/item.rb
|
148
|
+
- lib/freee/partner.rb
|
149
|
+
- lib/freee/tax.rb
|
150
|
+
- lib/freee/transfer.rb
|
151
|
+
- lib/freee/user.rb
|
152
|
+
- lib/freee/util.rb
|
153
|
+
- lib/freee/version.rb
|
154
|
+
- lib/freee/wallet.rb
|
155
|
+
- lib/freee/walletable.rb
|
156
|
+
- spec/account_spec.rb
|
157
|
+
- spec/amount_spec.rb
|
158
|
+
- spec/base_spec.rb
|
159
|
+
- spec/company_spec.rb
|
160
|
+
- spec/deal_spec.rb
|
161
|
+
- spec/item_spec.rb
|
162
|
+
- spec/partner_spec.rb
|
163
|
+
- spec/sample.yml
|
164
|
+
- spec/spec_helper.rb
|
165
|
+
- spec/tax_spec.rb
|
166
|
+
- spec/transfer_spec.rb
|
167
|
+
- spec/user_spec.rb
|
168
|
+
- spec/util_spec.rb
|
169
|
+
- spec/wallet_spec.rb
|
170
|
+
- spec/walletable_spec.rb
|
171
|
+
homepage: ''
|
172
|
+
licenses:
|
173
|
+
- MIT
|
174
|
+
metadata: {}
|
175
|
+
post_install_message:
|
176
|
+
rdoc_options: []
|
177
|
+
require_paths:
|
178
|
+
- lib
|
179
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - ">="
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '0'
|
184
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
|
+
requirements:
|
186
|
+
- - ">="
|
187
|
+
- !ruby/object:Gem::Version
|
188
|
+
version: '0'
|
189
|
+
requirements: []
|
190
|
+
rubyforge_project:
|
191
|
+
rubygems_version: 2.2.2
|
192
|
+
signing_key:
|
193
|
+
specification_version: 4
|
194
|
+
summary: Ruby implementation of the freee API.
|
195
|
+
test_files:
|
196
|
+
- spec/account_spec.rb
|
197
|
+
- spec/amount_spec.rb
|
198
|
+
- spec/base_spec.rb
|
199
|
+
- spec/company_spec.rb
|
200
|
+
- spec/deal_spec.rb
|
201
|
+
- spec/item_spec.rb
|
202
|
+
- spec/partner_spec.rb
|
203
|
+
- spec/sample.yml
|
204
|
+
- spec/spec_helper.rb
|
205
|
+
- spec/tax_spec.rb
|
206
|
+
- spec/transfer_spec.rb
|
207
|
+
- spec/user_spec.rb
|
208
|
+
- spec/util_spec.rb
|
209
|
+
- spec/wallet_spec.rb
|
210
|
+
- spec/walletable_spec.rb
|