Class: Workarea::Api::Admin::TaxCategoriesController
Instance Method Summary
collapse
#current_user, #sort_direction, #sort_field
Instance Method Details
#bulk ⇒ Object
227
228
229
230
231
232
233
234
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 227
def bulk
@bulk = Api::Admin::BulkUpsert.create!(
klass: Tax::Category,
data: params[:tax_categories].map(&:to_h)
)
head :no_content
end
|
#create ⇒ Object
83
84
85
86
87
88
89
90
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 83
def create
@tax_category = Tax::Category.create!(params[:tax_category])
respond_with(
{ tax_category: @tax_category },
{ status: :created,
location: tax_category_path(@tax_category) }
)
end
|
#destroy ⇒ Object
193
194
195
196
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 193
def destroy
@tax_category.destroy
head :no_content
end
|
#index ⇒ Object
72
73
74
75
76
77
78
79
80
81
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 72
def index
@tax_categories = Tax::Category
.all
.by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
.by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
.order_by(sort_field => sort_direction)
.page(params[:page])
respond_with tax_categories: @tax_categories
end
|
#show ⇒ Object
184
185
186
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 184
def show
respond_with tax_category: @tax_category
end
|
#update ⇒ Object
188
189
190
191
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 188
def update
@tax_category.update_attributes!(params[:tax_category])
respond_with tax_category: @tax_category
end
|