Class: Deployand::Command::Iap
- Inherits:
-
Deployand::Command
- Object
- CLAide::Command
- Deployand::Command
- Deployand::Command::Iap
- Defined in:
- lib/deployand/command/iap.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Iap
constructor
A new instance of Iap.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Iap
Returns a new instance of Iap.
26 27 28 29 30 31 32 33 34 |
# File 'lib/deployand/command/iap.rb', line 26 def initialize(argv) @action = argv.shift_argument @product_id = argv.option('product-id') @price = argv.option('price') @title = argv.option('title') @description = argv.option('description') @sync = argv.flag?('sync') super end |
Class Method Details
.options ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/deployand/command/iap.rb', line 16 def self. [ ['--product-id=PRODUCT_ID', 'Specify a product ID'], ['--price=PRICE', 'Set product price'], ['--title=TITLE', 'Set product title'], ['--description=DESCRIPTION', 'Set product description'], ['--sync', 'Sync with remote IAP configuration'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/deployand/command/iap.rb', line 44 def run case @action when 'create' create_iap_product when 'update' update_iap_product when 'list' list_iap_products when 'delete' delete_iap_product end end |
#validate! ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/deployand/command/iap.rb', line 36 def validate! super help! 'An action is required (create, update, list, delete).' unless @action valid_actions = %w[create update list delete] help! "Invalid action '#{@action}'. Valid actions: #{valid_actions.join(', ')}" unless valid_actions.include?(@action) end |