Sha256: f821a6b1fc9cf9e7fd028f526cb6d34e0d5e013a5e637767e1668f7893f1cd64

Contents?: true

Size: 1.65 KB

Versions: 5

Compression:

Stored size: 1.65 KB

Contents

require_dependency "ishapi/application_controller"

module Ishapi
  class UsersController < ApplicationController
    before_action :set_profile, :only => [ :fb_sign_in, :show ]

    def fb_sign_in
      authorize! :fb_sign_in, Ishapi
      # render :json => { :status => :ok }
      render :action => 'show'
    end

    def show
      authorize! :fb_sign_in, Ishapi
=begin
      begin
        @graph        = Koala::Facebook::API.new( params[:accessToken] )
        me            = @graph.get_object( 'me', :fields => 'email' )
        @user         = User.find_by                   :email => me['email']
        @user_profile = IshModels::UserProfile.find_by :email => me['email']
      rescue Koala::Facebook::AuthenticationError => e
        render :json => { :status => :not_ok, :errors => "Probably expired token." }
        return
      end
=end
    end

=begin
    def update
      authorize! :fb_sign_in, Ishapi
      begin
        @graph        = Koala::Facebook::API.new( params[:accessToken] )
        me            = @graph.get_object( 'me', :fields => 'email' )
        @user         = User.find_by( :email => me['email'] )
        @user_profile = IshModels::UserProfile.find_by :email => me['email']
        flag          = @user_profile.update_attributes( params[:user_profile].permit( :about, :current_city_id ) )
        @errors       = @user_profile.errors.messages
      rescue Koala::Facebook::AuthenticationError => e
        flag = false
        @errors = "Probably expired token."
      end
      if flag
        render :json => { :status => :ok }
      else
        render :json => { :status => :not_ok, :errors => @errors }
      end
    end
=end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ishapi-0.1.8.62 app/controllers/ishapi/users_controller.rb
ishapi-0.1.8.61 app/controllers/ishapi/users_controller.rb
ishapi-0.1.8.60 app/controllers/ishapi/users_controller.rb
ishapi-0.1.8.59 app/controllers/ishapi/users_controller.rb
ishapi-0.1.8.58 app/controllers/ishapi/users_controller.rb