Created
July 8, 2016 15:17
-
-
Save drymar/232c4243d1fe21fb9d7a983eb5dca110 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TicketsController < ApplicationController | |
respond_to? :js | |
def index | |
form = TicketFormValidator.new(form_params) | |
if form.valid? | |
@ticket = ticket_service(form.pnr_number) | |
@pnr = form.pnr_number | |
if @ticket.is_a? String | |
flash.now[:error] = @ticket | |
render 'shared/notice' | |
end | |
else | |
flash.now[:error] = 'Заполните пустые поля' | |
render 'shared/notice' | |
end | |
end | |
private | |
def form_params | |
params.permit(:provider, :pnr_number) | |
end | |
def ticket_service(pnr_number) | |
Kris::TicketRobotService.new.get_ticket(pnr_number) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment