Top Level Namespace

Defined Under Namespace

Modules: Api, ApplicationCable, ChatService, RailsBase, TwilioService Classes: AddChat, AddMessage, AddParticipant, Chat, ChatChannel, FacebookService, Message, Participant

Instance Method Summary collapse

Instance Method Details

#createObject



1
2
3
# File 'lib/templates/chat/sessions_controller.rb', line 1

def create
  super
end

#custom_sign_inObject



1
2
3
4
5
6
7
# File 'lib/templates/facebook/sessions_controller_2.rb', line 1

def 
  (:api_v1_user, @resource)
  new_auth_header = @resource.create_new_auth_token
  # update response with the header that will be required by the next request
  response.headers.merge!(new_auth_header)
  render_create_success
end

#destroyObject



5
6
7
# File 'lib/templates/chat/sessions_controller.rb', line 5

def destroy
  super
end

#facebookObject



1
2
3
4
5
6
7
8
9
# File 'lib/templates/facebook/sessions_controller.rb', line 1

def facebook
  user_params = FacebookService.new(params[:access_token]).profile
  @resource = User.from_social_provider 'facebook', user_params
  
rescue Koala::Facebook::AuthenticationError
  render json: { error: I18n.t('api.facebook.not_authorized') }, status: :forbidden
rescue ActiveRecord::RecordNotUnique
  render json: { error: I18n.t('api.facebook.already_registerd') }, status: :bad_request
end