Class: Googlepub::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/googlepub/options.rb

Constant Summary collapse

"Googlepub it gem for Google Android Publisheing API.\nAbilities:\n1) Store Listing\n2) APK - All tracks\n3) In-App Purchases (Managed and Subscriptions)\n\nUsage:\n  googlepub COMMAND [OPTIONS]\n  Main commands:\napk. metadata, inapps\nExample:\n  googlepub metadata -l \"en-US\" -p \"com.keshav.goel\" --store -t \"Title\" -s \"Short Description\" -f \"fullDescription\" --icon \"icon.png\"\n  googlepub apk -p \"com.keshav.goel\" --file \"file.apk\" --track \"beta\"\n  googlepub inapps -p \"com.keshav.goel\" --sku \"com.keshav.inapp.12\" --title \"InApp 12\" --fullDescription \"Description\" --price 1990000\n\nDependencies:\n  Ruby, HTTP\n\nAuthor: @thekeshavgoel\nEmail: [email protected]\n"

Instance Method Summary collapse

Constructor Details

#initializeOptions

Creating a CommandLine runs off of the contents of ARGV.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/googlepub/options.rb', line 35

def initialize
  parse_options
  cmd = ARGV.shift
  @command = cmd && cmd.to_sym
  @auth = Googlepub::Auth.new(@options)
  if @command != :inapps
    @auth.edit
    run
    @auth.validate_edit
    @auth.commit_edit
  else
    run
  end
end

Instance Method Details

#runObject



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/googlepub/options.rb', line 50

def run
  begin
    case @command
    when :apk   then puts Googlepub.call_apk(@options)
    when :metadata  then puts Googlepub.(@options)
    when :inapps then puts Googlepub.call_inapps(@options)
    else
      puts "Please provide command to Excute - 'apk' or 'metadata'"
      exit (1)
    end
  end
end

#usageObject

Print out the usage help message.



64
65
66
67
# File 'lib/googlepub/options.rb', line 64

def usage
  puts "\n#{@option_parser}\n"
  exit
end