Class: Bootpay::Commerce::CategoryModule

Inherits:
Object
  • Object
show all
Defined in:
lib/bootpay/commerce/category.rb

Instance Method Summary collapse

Constructor Details

#initialize(bootpay) ⇒ CategoryModule

Returns a new instance of CategoryModule.



6
7
8
# File 'lib/bootpay/commerce/category.rb', line 6

def initialize(bootpay)
  @bootpay = bootpay
end

Instance Method Details

#create(params) ⇒ Object

카테고리 생성



21
22
23
# File 'lib/bootpay/commerce/category.rb', line 21

def create(params)
  @bootpay.post('categories', params)
end

#destroy(category_id) ⇒ Object

카테고리 삭제



34
35
36
# File 'lib/bootpay/commerce/category.rb', line 34

def destroy(category_id)
  @bootpay.delete("categories/#{category_id}")
end

#detail(category_id) ⇒ Object

카테고리 단건 조회



16
17
18
# File 'lib/bootpay/commerce/category.rb', line 16

def detail(category_id)
  @bootpay.get("categories/#{category_id}")
end

#listObject

카테고리 트리 조회



11
12
13
# File 'lib/bootpay/commerce/category.rb', line 11

def list
  @bootpay.get('categories')
end

#update(params) ⇒ Object

카테고리 수정

Raises:

  • (ArgumentError)


26
27
28
29
30
31
# File 'lib/bootpay/commerce/category.rb', line 26

def update(params)
  raise ArgumentError, 'category_id is required' unless params[:category_id]
  category_id = params[:category_id]
  body = params.reject { |k, _| k == :category_id }
  @bootpay.put("categories/#{category_id}", body)
end