Class: HurriyetCli::HammerOfTheGods

Inherits:
Thor
  • Object
show all
Defined in:
lib/hurriyet_cli/cli.rb

Instance Method Summary collapse

Instance Method Details

#articlesObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/hurriyet_cli/cli.rb', line 13

def articles
  client = Hurriyet::Client.new(ENV['API_KEY'])
  articles = HurriyetCli::Articles.new(client)
  if options[:top]
    puts "Fetching #{options[:top]} articles"
    articles.top_articles(options[:top])
  else
    puts "Fetching all articles"
    articles.fetch
  end
end

#columnsObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/hurriyet_cli/cli.rb', line 27

def columns
  client = Hurriyet::Client.new(ENV['API_KEY'])
  columns = HurriyetCli::Columns.new(client)
  if options[:top]
    puts "Fetching #{options[:top]} columns"
    columns.top_columns(options[:top])
  else
    puts "Fetching all columns"
    columns.fetch
  end
end

#pagesObject



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/hurriyet_cli/cli.rb', line 41

def pages
  client = Hurriyet::Client.new(ENV['API_KEY'])
  pages = HurriyetCli::Pages.new(client)
  if options[:top]
    puts "Fetching #{options[:top]} pages"
    pages.top_pages(options[:top])
  else
    puts "Fetching all pages"
    pages.fetch
  end
end

#writersObject



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/hurriyet_cli/cli.rb', line 55

def writers
  client = Hurriyet::Client.new(ENV['API_KEY'])
  writers = HurriyetCli::Writers.new(client)
  if options[:top]
    puts "Fetching #{options[:top]} writers"
    writers.top_writers(options[:top])
  else
    puts "Fetching all writers"
    writers.fetch
  end
end