Class: InstaReadability::CLI

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/insta_readability/cli.rb

Constant Summary collapse

USAGE_MESSAGE =
"Usage: $0 PATH_TO_CSV_FILE"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



12
13
14
# File 'lib/insta_readability/cli.rb', line 12

def initialize
  @auth = Auth.get_access_token
end

Instance Attribute Details

#authObject (readonly)

Returns the value of attribute auth.



10
11
12
# File 'lib/insta_readability/cli.rb', line 10

def auth
  @auth
end

Class Method Details

.run(csv_path = '') ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/insta_readability/cli.rb', line 16

def self.run(csv_path='')
  if csv_path == ''
    $stderr.print USAGE_MESSAGE
    return
  end

  parser   = InstaReadability::InstapaperParser.new csv_path
  importer = InstaReadability::Importer.new(instance.auth.token, instance.auth.secret)
  importer.import parser.create_bookmarks
end