Class: Comee::Core::CustomsDetailsController

Inherits:
ApplicationController show all
Includes:
Common
Defined in:
app/controllers/comee/core/customs_details_controller.rb

Instance Method Summary collapse

Methods included from Common

#create, #index, #show, #update

Methods included from Pagination

#default_per_page, #order_by, #order_direction, #page_no, #paginate, #paginate_offset, #per_page

Methods inherited from ApplicationController

#application_code, #authenticate, #current_application, #current_user, #render_content, #render_error, #skip_bullet

Instance Method Details

#filterObject



6
7
8
9
# File 'app/controllers/comee/core/customs_details_controller.rb', line 6

def filter
  customs_details = Comee::Core::CustomsDetail.includes(:sales_order).ransack(params[:q]).result
  render_content(customs_details)
end

#generate_beo_xmlObject



19
20
21
22
23
24
25
# File 'app/controllers/comee/core/customs_details_controller.rb', line 19

def generate_beo_xml
  service = BeoService.new(publish_params[:ids])
  data = service.preprocess_data(xml: true)
  render json: {success: true, data: data}
rescue StandardError => e
  render json: {success: false, error: e.message}, status: 422
end

#send_customs_detailsObject



11
12
13
14
15
16
17
# File 'app/controllers/comee/core/customs_details_controller.rb', line 11

def send_customs_details
  service = BeoService.new(publish_params[:ids])
  data = service.send_customs_details
  render json: {success: true, data: data}
rescue StandardError => e
  render json: {success: false, error: e.message}, status: 422
end