lib/controllers/get.rb in evertils-0.2.0 vs lib/controllers/get.rb in evertils-0.2.1
- old
+ new
@@ -2,40 +2,25 @@
module Controller
class Get < Controller::Base
attr_accessor :title, :file, :notebook
def pre_exec
- begin
- # interface with the Evernote API so we can use it later
- @model = Evertils::Helper.load('evernote')
+ # command flag parser
+ OptionParser.new do |opt|
+ opt.banner = "#{Evertils::PACKAGE_NAME} new note [...-flags]"
- # all methods require internet to make API calls
- @methods_require_internet.push(:daily, :weekly, :monthly)
+ opt.on("-t", "--title=TITLE", "Set a custom title") do |title|
+ @title = title
+ end
- # command flag parser
- OptionParser.new do |opt|
- opt.banner = "#{Evertils::PACKAGE_NAME} new note [...-flags]"
+ opt.on("-f", "--file=PATH", "Attach a file to your custom note") do |file|
+ @file = file
+ end
- opt.on("-t", "--title=TITLE", "Set a custom title") do |title|
- @title = title
- end
-
- opt.on("-f", "--file=PATH", "Attach a file to your custom note") do |file|
- @file = file
- end
-
- opt.on("-n", "--notebook=PBOOK", "Attach a file to your custom note") do |notebook|
- @notebook = notebook
- end
- end.parse!
-
- # user = @model.user
- # Notify.success("Welcome, #{user.name} (#{user.username})")
- rescue ::Evernote::EDAM::Error::EDAMSystemException => e
- Notify.error("Evernote.authenticate error\n#{e.message} (#{e.errorCode})")
- rescue ::Evernote::EDAM::Error::EDAMUserException => e
- Notify.error("Evernote.authenticate error\n#{e.parameter} (#{e.errorCode})")
- end
+ opt.on("-n", "--notebook=PBOOK", "Attach a file to your custom note") do |notebook|
+ @notebook = notebook
+ end
+ end.parse!
super
end
# Get data about a notebook, prints titles of each child note