spaceship/lib/spaceship/tunes/tunes_client.rb in fastlane-2.32.0.beta.20170518010031 vs spaceship/lib/spaceship/tunes/tunes_client.rb in fastlane-2.32.0
- old
+ new
@@ -512,13 +512,15 @@
# }, {
# ...
# }, {
# ...
def pricing_tiers
- r = request(:get, 'ra/apps/pricing/matrix')
- data = parse_response(r, 'data')['pricingTiers']
- data.map { |tier| Spaceship::Tunes::PricingTier.factory(tier) }
+ @pricing_tiers ||= begin
+ r = request(:get, 'ra/apps/pricing/matrix')
+ data = parse_response(r, 'data')['pricingTiers']
+ data.map { |tier| Spaceship::Tunes::PricingTier.factory(tier) }
+ end
end
#####################################################
# @!group Availability
#####################################################
@@ -1009,19 +1011,32 @@
def delete_iap!(app_id: nil, purchase_id: nil)
r = request(:delete, "ra/apps/#{app_id}/iaps/#{purchase_id}")
handle_itc_response(r)
end
- # loads the full In-App-Purchases
+ # Loads the full In-App-Purchases
def load_iap(app_id: nil, purchase_id: nil)
r = request(:get, "ra/apps/#{app_id}/iaps/#{purchase_id}")
parse_response(r, 'data')
end
- # loads the full In-App-Purchases-Family
+ # Loads the full In-App-Purchases-Family
def load_iap_family(app_id: nil, family_id: nil)
r = request(:get, "ra/apps/#{app_id}/iaps/family/#{family_id}")
parse_response(r, 'data')
+ end
+
+ # Loads the full In-App-Purchases-Pricing-Matrix
+ # note: the matrix is the same for any app_id
+ #
+ # @param app_id (String) The Apple ID of any app
+ # @return ([Spaceship::Tunes::IAPSubscriptionPricingTier]) An array of pricing tiers
+ def subscription_pricing_tiers(app_id)
+ @subscription_pricing_tiers ||= begin
+ r = request(:get, "ra/apps/#{app_id}/iaps/pricing/matrix/recurring")
+ data = parse_response(r, "data")["pricingTiers"]
+ data.map { |tier| Spaceship::Tunes::IAPSubscriptionPricingTier.factory(tier) }
+ end
end
# updates an In-App-Purchases-Family
def update_iap_family!(app_id: nil, family_id: nil, data: nil)
with_tunes_retry do