Sha256: ba7a95007a44c3f9c52801988c4881622b29f890427b0034edb5a759f566c7d2

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

require_relative 'module'
require 'spaceship'

module Deliver
  # Set the app's pricing
  class UploadPriceTier
    def upload(options)
      return unless options[:price_tier]

      price_tier = options[:price_tier].to_s

      legacy_app = options[:app]
      app_id = legacy_app.apple_id
      app = Spaceship::ConnectAPI::App.get(app_id: app_id)

      app_prices = app.fetch_app_prices
      if app_prices.first
        old_price = app_prices.first.id
      end

      if price_tier == old_price
        UI.success("Price Tier unchanged (tier #{old_price})")
        return
      end

      app.update_app_price_tier(app_price_tier_id: price_tier)
      UI.success("Successfully updated the pricing from #{old_price} to #{price_tier}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fastlane-2.150.0.rc1 deliver/lib/deliver/upload_price_tier.rb