Class: Deliver::UploadPriceTier

Inherits:
Object
  • Object
show all
Defined in:
deliver/lib/deliver/upload_price_tier.rb

Overview

Set the app’s pricing

Instance Method Summary collapse

Instance Method Details

#upload(options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'deliver/lib/deliver/upload_price_tier.rb', line 6

def upload(options)
  return unless options[:price_tier]
  app = options[:app]

  # just to be sure, the user might have passed an int (which is fine with us)
  options[:price_tier] = options[:price_tier].to_s

  old_price = app.price_tier
  if options[:price_tier] == old_price
    UI.success("Price Tier unchanged (tier #{options[:price_tier]})")
    return
  end

  app.update_price_tier!(options[:price_tier])
  UI.success("Successfully updated the pricing from #{old_price} to #{options[:price_tier]}")
end