Class: WhosDatedWho::CLI

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

Instance Method Summary collapse

Instance Method Details

#exploreObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/whos_dated_who/cli.rb', line 23

def explore
  my_celebs.map do |celeb|
    puts "Processing #{celeb}..."
    begin
      Client.new.fetch(celeb)
    rescue
      puts "Error processing #{celeb}"
    end
  end.compact
end

#import_maximObject



40
41
42
43
# File 'lib/whos_dated_who/cli.rb', line 40

def import_maxim
  # TODO
  # resp = Faraday.get('http://www.maxim.com/hot100/2014')
end

#import_mineObject



35
36
37
# File 'lib/whos_dated_who/cli.rb', line 35

def import_mine
  Importer.new('celebs', 'mine').fetch_and_import(my_celebs)
end

#query(name) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/whos_dated_who/cli.rb', line 12

def query(name)
  result = Client.new.fetch(name)
  status = [
    result[:status], result[:current_relationship][:human]
  ].join(': ')

  puts status
  puts result[:current_relationship][:dates].join(', ')
end

#versionObject



7
8
9
# File 'lib/whos_dated_who/cli.rb', line 7

def version
  puts WhosDatedWho::VERSION
end