Class: Googlepub::Options

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

Constant Summary collapse

<<-EOS
Googlepub it gem for Google Android Publisheing API.
Abilities:
1) Store Listing
2) APK - All tracks
3) In-App Purchases (Managed and Subscriptions)

Usage:
  googlepub COMMAND [OPTIONS]
  Main commands:
apk. metadata, inapps
Example:
  googlepub metadata -l "en-US" -p "com.keshav.goel" --store -t "Title" -s "Short Description" -f "fullDescription" --icon "icon.png"
  googlepub apk -p "com.keshav.goel" --file "file.apk" --track "beta"
  googlepub inapps -p "com.keshav.goel" --sku "com.keshav.inapp.12" --title "InApp 12" --fullDescription "Description" --price 1990000

Dependencies:
  Ruby, HTTP

Author: @thekeshavgoel
Email: [email protected]
EOS

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