Class: UnderFire::CLI

Inherits:
Thor
  • Object
show all
Includes:
UnderFire
Defined in:
lib/under_fire/cli.rb

Overview

Command Line interface

Constant Summary

Constants included from UnderFire

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



12
13
14
15
16
# File 'lib/under_fire/cli.rb', line 12

def initialize(*)
  super
  @config = Configuration.instance
  @client = Client.new()
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

Instance Method Details

#albumObject



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

def album
  say client.find_album(options)
end

#coverObject



69
70
71
72
73
74
75
# File 'lib/under_fire/cli.rb', line 69

def cover
  say "Fetching cover" if options[:verbose]
  url = options[:url]
  file_name = options[:file_name].empty? ? "cover.jpg" : options[:file_name]
  APIRequest.get_file(url, file_name)
  say "saved #{file_name} in #{File.dirname __FILE__}" if options[:verbose]
end

#idObject



50
51
52
# File 'lib/under_fire/cli.rb', line 50

def id
  puts "Not implemented"
end

#registerObject



81
82
83
# File 'lib/under_fire/cli.rb', line 81

def register
  say client.register(options[:client_id])
end

#tocObject



24
25
26
# File 'lib/under_fire/cli.rb', line 24

def toc
  say client.find_by_toc(options[:offsets])
end