Class: Freee::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/freee/base.rb

Direct Known Subclasses

Account, Amount, Company, Deal, Item, Partner, 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

#initializeBase

Returns a new instance of Base.



28
# File 'lib/freee/base.rb', line 28

def initialize; end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/freee/base.rb', line 14

def client
  @client
end

Class Method Details

.config(client_id, secret_key, token) ⇒ Object



22
23
24
25
26
# File 'lib/freee/base.rb', line 22

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_envObject



16
17
18
19
20
# File 'lib/freee/base.rb', line 16

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) ⇒ Object



43
44
45
# File 'lib/freee/base.rb', line 43

def get(path)
  @client.get(path).response.env[:body]
end

#tokenObject



35
36
37
# File 'lib/freee/base.rb', line 35

def token
  @@token
end

#token=(token) ⇒ Object



39
40
41
# File 'lib/freee/base.rb', line 39

def token=(token)
  @@token = token
end