class GetPocketSend::CLI

Attributes

email[RW]
TODO

No needed declaration…

input[RW]
TODO

No needed declaration…

output[RW]
TODO

No needed declaration…

password[RW]
TODO

No needed declaration…

Public Class Methods

new(email, password) click to toggle source
# File lib/get_pocket_send.rb, line 14
def initialize email, password
  self.input  = $stdin
  self.output = $stdout

  @email = email
  @password = password
end

Public Instance Methods

start() click to toggle source
# File lib/get_pocket_send.rb, line 23
def start
  error_handler do
    hash = Parser.get_title_and_link_by

    hash.each do |key, value|
      message_current_site(key)

      value.each_with_index do |title_and_link, index|
        title = title_and_link[0]
        link  = title_and_link[1]

        output.puts "#{index + 1}: #{title}"
        output.puts "( #{link} )"

        message_save_article

        if handling_permission?
          send_email_with({ body: link, subject: title })
        else
          message_next
        end
      end
    end
  end
end

Private Instance Methods

error_handler() { || ... } click to toggle source
# File lib/get_pocket_send.rb, line 50
def error_handler
  begin
    yield
  rescue SystemExit
    message_goodbie
    exit 1
  end
end