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

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

.create(json) ⇒ Object



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

def self.create(json)
  params = Freee.encode_json(json)
  Freee.client.post('/api//1/deals', :deal, params)
end

.list(company_id, **kwargs) ⇒ Object



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

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



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

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

.list_income(company_id, **kwargs) ⇒ Object



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

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