Class: Freee::Deal

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

Instance Attribute Summary

Attributes inherited from Base

#client

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

config, #get, #initialize, #post, set_env, #token, #token=

Constructor Details

This class inherits a constructor from Freee::Base

Class Method Details

.list(company_id, **kwargs) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/freee/deal.rb', line 7

def self.list(company_id, **kwargs)
  params = Freee.encode_params(kwargs)
  Freee.client.get(
    "/api/1/deals?company_id=#{company_id.to_i}#{params}",
    :deal
  )
end

.list_expense(company_id, **kwargs) ⇒ Object



20
21
22
23
# File 'lib/freee/deal.rb', line 20

def self.list_expense(company_id, **kwargs)
  kwargs[:type] = 'expense'
  self.list(company_id, **kwargs)
end

.list_income(company_id, **kwargs) ⇒ Object



15
16
17
18
# File 'lib/freee/deal.rb', line 15

def self.list_income(company_id, **kwargs)
  kwargs[:type] = 'income'
  self.list(company_id, **kwargs)
end

Instance Method Details

#createObject



3
4
5
# File 'lib/freee/deal.rb', line 3

def create
  Freeee.client.post('/api/1/deals', :deals, **kwargs)
end