Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ShipmentsController < ApplicationController
- authorize_resource
- def get_point
- points = SetShipmentService.new(
- service_name: params[:service_name],
- q: params[:city_code]).get_point
- if points[0]['err']
- render_data(points)
- else
- points = points.map {|add| [add["Address"], add["Code"]]}
- render_data(points)
- end
- end
- def calculation
- price = SetShipmentService.new(
- q: params[:point_id],
- service_name: params[:service_name]).calculation
- render_data(price)
- end
- def list_cities
- get_cities = SetShipmentService.new(
- service_name: params[:service_name],
- q: params[:name_startsWith]).list_cities
- render_data(get_cities)
- end
- def show_on_map
- get_points = SetShipmentService.new(
- service_name: params[:service_name],
- q: params[:point_id],
- city_code: params[:city_code]).show_on_map
- render_data(get_points)
- end
- # Курьерская доставка
- def get_zip_code
- zip_code = SetShipmentService.new(
- q: params[:point_id],
- service_name: params[:service_name]).get_zip_code
- render_data(zip_code)
- end
- def express_delivery_cities
- courier_city = SetShipmentService.new(
- q: params[:point_id],
- service_name: params[:service_name]).express_delivery_cities
- render_data(courier_city)
- end
- def express
- courier_city = SetShipmentService.new(
- q: params[:q],
- service_name: params[:service_name]).express
- render_data(courier_city)
- end
- private def render_data(data_json)
- respond_to do |format|
- format.json { render json: data_json }
- end
- end
- end
Add Comment
Please, Sign In to add comment