Sha256: 4aab8f53039c498594e50f4cb16bb5be0fc63eee641f0eb695949fb17cb10e0b

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module FlyAdmin::Imbs
  class SubscriptionsController < ApplicationController
    def start
      save_data_to_session

      link_uuid = session[:link] || SiteConfig['default_uuid']
      back_url = CGI.escape "http://#{request.host_with_port}/you_blocked"
      redirect_to "#{SiteConfig['wap_click_addr']}/start/#{link_uuid}?back_url=#{back_url}"
    end
    
    def splash  
      begin
        link = params[:back_url] + "?key=#{params[:customer_key]}"
        redirect_to link
      rescue Exception => e 
        SUBSCRIPTION_LOG.error "#{e.message}\n\t#{e.backtrace}"
        render nothing: true
      end  
    end
    
    private
    
    def save_data_to_session
      case FlyAdmin.paysite_type
      when "serials"
        save_serials_data_to_session
      when "news"
        save_news_data_to_session
      end
    end
    
    def save_serials_data_to_session
      session[:item] = JSON.generate({ :id => params[:video_id], :category_id => params[:category_id], :season_id => params[:season_id] })
    end

    def save_news_data_to_session
      session[:item] = JSON.generate({ :id => params[:item_id], :category_id => params[:category_id] })        
    end 
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fly_admin-0.0.8 app/controllers/fly_admin/imbs/subscriptions_controller.rb