diff options
| author | Teddy Wing | 2015-12-30 17:57:19 -0800 | 
|---|---|---|
| committer | Teddy Wing | 2015-12-30 17:57:19 -0800 | 
| commit | bbca4f8cf04d8ca3bdde981a53d7d49f3ff5bec0 (patch) | |
| tree | 88682dd19c31f077202f70f11b08320d52e8fa3c /app/controllers | |
| parent | 21e6572e9dd2ec3df6a0b9de877c09dd376ee282 (diff) | |
| download | Evernote-Rails-Example-bbca4f8cf04d8ca3bdde981a53d7d49f3ff5bec0.tar.bz2 | |
NotesController#index: List Evernote notebook names
List the names of all Evernote notebooks.
We create a new service to make it easier to query the Evernote Ruby SDK
and get all notebooks from it. This code to list notebooks was copied
from the Evernote Ruby SDK's sample EDAMTest.rb file
(https://github.com/evernote/evernote-sdk-ruby/blob/master/sample/client/EDAMTest.rb#L52-L62).
In our controller, we call this service to get our notebooks and pass
those to the view where we display each notebook's name.
Hard-coded the my Evernote Sandbox access token and NoteStore URL
because I didn't save them in the OmniAuth OAuth process. Using these to
query the Evernote API using the SDK.
Note to self: I'll want to deactivate that Evernote Sandbox account
before releasing this.
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/notes_controller.rb | 7 | 
1 files changed, 7 insertions, 0 deletions
| diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb index 71be366..a4391f6 100644 --- a/app/controllers/notes_controller.rb +++ b/app/controllers/notes_controller.rb @@ -1,4 +1,11 @@ +require_relative '../services/evernote' +  class NotesController < ApplicationController    def index +    auth_token = 'S=s1:U=91e2f:E=151f92661a2:C=151f4000220:P=185:A=evernotesandbox199:V=2:H=5777502290baf1ae1b36ad6254592258' +    notestore_url = 'https://sandbox.evernote.com/shard/s1/notestore' +     +    e = EvernoteService.new(auth_token, notestore_url) +    @notebooks = e.notebooks    end  end | 
