Sha256: 7219b819fb9d81fbe9ff17dd600e21cc15909c92e2dd75a01daf4c6e49f3d6e7
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
module Granify module Controller class Generate < Controller::Base def pre_exec begin # interface with the Evernote API so we can use it later @model = Granify::Helper.load('evernote') # all methods require internet to make API calls @methods_require_internet.push(:daily, :weekly, :monthly) # 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 super end # generate daily notes def daily if @model.note_exists Notify.error("There's already a log for today!") end @model.create_note end # generate weekly notes def weekly if @model.note_exists Notify.error("There's already a log for this week!") end if !Date.today.monday? Notify.error("Sorry, you can only create new weekly logs on Mondays") end @model.create_note end # generate monthly notes def monthly if @model.note_exists Notify.error("There's already a log for this month!") end @model.create_note end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
evertils-0.1.4 | lib/controllers/generate.rb |
evertils-0.1.3 | lib/controllers/generate.rb |