From 358bad0827736ce61f24a640199ee2a99e9119c3 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 30 Dec 2015 17:19:37 -0800 Subject: Add Auth::EvernoteController Include some sample code from the 'evernote-oauth' gem README (https://github.com/evernote/evernote-oauth-ruby). Not quite sure how I'm going to get this to work just yet though. --- app/assets/javascripts/auth/evernote.coffee | 3 +++ app/assets/stylesheets/auth/evernote.scss | 3 +++ app/controllers/auth/evernote_controller.rb | 12 ++++++++++++ app/helpers/auth/evernote_helper.rb | 2 ++ app/views/auth/evernote/index.html | 1 + test/controllers/auth/evernote_controller_test.rb | 7 +++++++ 6 files changed, 28 insertions(+) create mode 100644 app/assets/javascripts/auth/evernote.coffee create mode 100644 app/assets/stylesheets/auth/evernote.scss create mode 100644 app/controllers/auth/evernote_controller.rb create mode 100644 app/helpers/auth/evernote_helper.rb create mode 100644 app/views/auth/evernote/index.html create mode 100644 test/controllers/auth/evernote_controller_test.rb diff --git a/app/assets/javascripts/auth/evernote.coffee b/app/assets/javascripts/auth/evernote.coffee new file mode 100644 index 0000000..24f83d1 --- /dev/null +++ b/app/assets/javascripts/auth/evernote.coffee @@ -0,0 +1,3 @@ +# Place all the behaviors and hooks related to the matching controller here. +# All this logic will automatically be available in application.js. +# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/auth/evernote.scss b/app/assets/stylesheets/auth/evernote.scss new file mode 100644 index 0000000..30f4c8c --- /dev/null +++ b/app/assets/stylesheets/auth/evernote.scss @@ -0,0 +1,3 @@ +// Place all the styles related to the auth/evernote controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ diff --git a/app/controllers/auth/evernote_controller.rb b/app/controllers/auth/evernote_controller.rb new file mode 100644 index 0000000..c581e31 --- /dev/null +++ b/app/controllers/auth/evernote_controller.rb @@ -0,0 +1,12 @@ +class Auth::EvernoteController < ApplicationController + def index + client = EvernoteOAuth::Client.new + request_token = client.request_token(:oauth_callback => '/auth/evernote/callback') + request_token.authorize_url + @access_token = request_token.get_access_token(oauth_verifier: params[:oauth_verifier]) + end + + def callback + render 'le callback' + end +end diff --git a/app/helpers/auth/evernote_helper.rb b/app/helpers/auth/evernote_helper.rb new file mode 100644 index 0000000..0147d5c --- /dev/null +++ b/app/helpers/auth/evernote_helper.rb @@ -0,0 +1,2 @@ +module Auth::EvernoteHelper +end diff --git a/app/views/auth/evernote/index.html b/app/views/auth/evernote/index.html new file mode 100644 index 0000000..5db3554 --- /dev/null +++ b/app/views/auth/evernote/index.html @@ -0,0 +1 @@ +<%= @access_token %> diff --git a/test/controllers/auth/evernote_controller_test.rb b/test/controllers/auth/evernote_controller_test.rb new file mode 100644 index 0000000..5505b58 --- /dev/null +++ b/test/controllers/auth/evernote_controller_test.rb @@ -0,0 +1,7 @@ +require 'test_helper' + +class Auth::EvernoteControllerTest < ActionController::TestCase + # test "the truth" do + # assert true + # end +end -- cgit v1.2.3