Sha256: 60e6e1ccc6c69a7d73faafcbdadd7a1708d742b4cf7c31c5dd51a336e7a62782

Contents?: true

Size: 1.78 KB

Versions: 493

Compression:

Stored size: 1.78 KB

Contents

module Spaceship
  module Tunes
    # Defines the different in-app purchase product types
    #
    # As specified by Apple: https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html
    module IAPType
      CONSUMABLE = "consumable"
      NON_CONSUMABLE = "nonConsumable"
      RECURRING = "recurring"
      NON_RENEW_SUBSCRIPTION = "subscription"

      # A product that is used once
      READABLE_CONSUMABLE = "Consumable"

      # A product that is purchased once and does not expire or decrease with use.
      READABLE_NON_CONSUMABLE = "Non-Consumable"

      # A product that allows users to purchase dynamic content for a set period (auto-rene).
      READABLE_AUTO_RENEWABLE_SUBSCRIPTION = "Auto-Renewable Subscription"

      # A product that allows users to purchase a service with a limited duration.
      READABLE_NON_RENEWING_SUBSCRIPTION = "Non-Renewing Subscription"

      # Get the iap type matching based on a string (given by App Store Connect)
      def self.get_from_string(text)
        mapping = {
          'ITC.addons.type.consumable' => READABLE_CONSUMABLE,
          'ITC.addons.type.nonConsumable' => READABLE_NON_CONSUMABLE,
          'ITC.addons.type.recurring' => READABLE_AUTO_RENEWABLE_SUBSCRIPTION,
          'ITC.addons.type.subscription' => READABLE_NON_RENEWING_SUBSCRIPTION,
          'consumable' => READABLE_CONSUMABLE,
          'nonConsumable' => READABLE_NON_CONSUMABLE,
          'recurring' => READABLE_AUTO_RENEWABLE_SUBSCRIPTION,
          'subscription' => READABLE_NON_RENEWING_SUBSCRIPTION
        }

        mapping.each do |itc_type, readable_type|
          return readable_type if itc_type == text
        end

        return nil
      end
    end
  end
end

Version data entries

493 entries across 493 versions & 5 rubygems

Version Path
fastlane-2.114.0.beta.20190108200048 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20190107200010 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20190106200016 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20190105200036 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20190104200013 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20190103200013 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20190102200016 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20190101200013 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181231200027 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181230200014 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181229200101 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181228200027 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181227200058 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181226200116 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181225200026 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181224200038 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181223200038 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181222200027 spaceship/lib/spaceship/tunes/iap_type.rb
fastlane-2.113.0.beta.20181221200014 spaceship/lib/spaceship/tunes/iap_type.rb