Class: Freee::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/freee/base.rb
Direct Known Subclasses
Account, Amount, Company, Deal, Item, Partner, Response::Account, Response::Amount, Response::Company, Response::Deal, Response::Item, Response::Partner, Response::Tax, Response::User, Response::Wallet, Tax, Transfer, User, Wallet, Walletable
Constant Summary
collapse
- @@client_id =
nil
- @@secret_key =
nil
- @@token =
nil
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
45
|
# File 'lib/freee/base.rb', line 45
def initialize; end
|
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
31
32
33
|
# File 'lib/freee/base.rb', line 31
def client
@client
end
|
Class Method Details
.config(client_id, secret_key, token) ⇒ Object
39
40
41
42
43
|
# File 'lib/freee/base.rb', line 39
def self.config(client_id, secret_key, token)
@@client_id = client_id.to_s
@@secret_key = secret_key.to_s
@@token = token.to_s
end
|
.set_env ⇒ Object
33
34
35
36
37
|
# File 'lib/freee/base.rb', line 33
def self.set_env
@@client_id = ENV["FREEE_CLIENT_ID"]
@@secret_key = ENV["FREEE_SECRET_KEY"]
@@token = ENV["FREEE_APPLICATION_TOKEN"]
end
|
Instance Method Details
#get(path, type = nil) ⇒ Object
60
61
62
63
|
# File 'lib/freee/base.rb', line 60
def get(path, type=nil)
response = @client.get(path).response.env[:body]
return Freee::Response::Type.convert(response, type)
end
|
#post(path, type = nil, **kwargs) ⇒ Object
65
66
67
68
|
# File 'lib/freee/base.rb', line 65
def post(path, type=nil, **kwargs)
response = @client.post(path, { params: kwargs }).response.env[:body]
return Freee::Response::Type.convert(response, type)
end
|
#token ⇒ Object
52
53
54
|
# File 'lib/freee/base.rb', line 52
def token
@@token
end
|
#token=(token) ⇒ Object
56
57
58
|
# File 'lib/freee/base.rb', line 56
def token=(token)
@@token = token
end
|