fastlane 2.13.0 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/credentials_manager/lib/credentials_manager.rb +1 -1
  3. data/fastlane/lib/fastlane/actions/ipa.rb +2 -1
  4. data/fastlane/lib/fastlane/actions/mailgun.rb +15 -2
  5. data/fastlane/lib/fastlane/actions/scan.rb +14 -0
  6. data/fastlane/lib/fastlane/documentation/docs_generator.rb +24 -1
  7. data/fastlane/lib/fastlane/environment_printer.rb +2 -1
  8. data/fastlane/lib/fastlane/fast_file.rb +4 -4
  9. data/fastlane/lib/fastlane/version.rb +1 -1
  10. data/fastlane_core/lib/fastlane_core.rb +1 -1
  11. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +44 -2
  12. data/fastlane_core/lib/fastlane_core/device_manager.rb +15 -0
  13. data/fastlane_core/lib/fastlane_core/helper.rb +1 -1
  14. data/fastlane_core/lib/fastlane_core/ui/disable_colors.rb +4 -4
  15. data/frameit/lib/frameit/config_parser.rb +8 -13
  16. data/frameit/lib/frameit/editor.rb +3 -2
  17. data/gym/lib/gym/options.rb +4 -2
  18. data/match/README.md +2 -2
  19. data/match/lib/match.rb +5 -19
  20. data/match/lib/match/generator.rb +8 -1
  21. data/match/lib/match/git_helper.rb +3 -1
  22. data/match/lib/match/nuke.rb +18 -14
  23. data/match/lib/match/options.rb +13 -2
  24. data/match/lib/match/runner.rb +20 -8
  25. data/match/lib/match/table_printer.rb +5 -4
  26. data/match/lib/match/utils.rb +12 -8
  27. data/scan/lib/scan/options.rb +24 -1
  28. data/scan/lib/scan/runner.rb +12 -11
  29. data/scan/lib/scan/test_command_generator.rb +10 -2
  30. data/sigh/lib/sigh/download_all.rb +1 -1
  31. data/sigh/lib/sigh/runner.rb +2 -2
  32. data/snapshot/lib/snapshot/options.rb +2 -1
  33. data/snapshot/lib/snapshot/runner.rb +12 -12
  34. data/spaceship/lib/spaceship.rb +1 -0
  35. data/spaceship/lib/spaceship/base.rb +27 -4
  36. data/spaceship/lib/spaceship/client.rb +3 -2
  37. data/spaceship/lib/spaceship/du/du_client.rb +26 -16
  38. data/spaceship/lib/spaceship/portal/app.rb +1 -1
  39. data/spaceship/lib/spaceship/portal/person.rb +53 -0
  40. data/spaceship/lib/spaceship/portal/persons.rb +49 -0
  41. data/spaceship/lib/spaceship/portal/portal.rb +2 -0
  42. data/spaceship/lib/spaceship/portal/portal_client.rb +69 -10
  43. data/spaceship/lib/spaceship/portal/provisioning_profile.rb +29 -1
  44. data/spaceship/lib/spaceship/tunes/application.rb +11 -1
  45. data/spaceship/lib/spaceship/tunes/iap.rb +113 -0
  46. data/spaceship/lib/spaceship/tunes/iap_detail.rb +185 -0
  47. data/spaceship/lib/spaceship/tunes/iap_families.rb +62 -0
  48. data/spaceship/lib/spaceship/tunes/iap_family_details.rb +59 -0
  49. data/spaceship/lib/spaceship/tunes/iap_family_list.rb +33 -0
  50. data/spaceship/lib/spaceship/tunes/iap_list.rb +72 -0
  51. data/spaceship/lib/spaceship/tunes/iap_status.rb +48 -0
  52. data/spaceship/lib/spaceship/tunes/iap_type.rb +45 -0
  53. data/spaceship/lib/spaceship/tunes/tunes.rb +1 -0
  54. data/spaceship/lib/spaceship/tunes/tunes_client.rb +163 -1
  55. metadata +21 -5
@@ -0,0 +1,45 @@
1
+ module Spaceship
2
+ module Tunes
3
+ # Defines the different in-app purchase product types
4
+ #
5
+ # As specified by Apple: https://developer.apple.com/library/content/documentation/LanguagesUtilities/Conceptual/iTunesConnectInAppPurchase_Guide/Chapters/CreatingInAppPurchaseProducts.html
6
+ module IAPType
7
+ CONSUMABLE = "consumable"
8
+ NON_CONSUMABLE = "nonConsumable"
9
+ RECURRING = "recurring"
10
+ NON_RENEW_SUBSCRIPTION = "subscription"
11
+
12
+ # A product that is used once
13
+ READABLE_CONSUMABLE = "Consumable"
14
+
15
+ # A product that is purchased once and does not expire or decrease with use.
16
+ READABLE_NON_CONSUMABLE = "Non-Consumable"
17
+
18
+ # A product that allows users to purchase dynamic content for a set period (auto-rene).
19
+ READABLE_AUTO_RENEWABLE_SUBSCRIPTION = "Auto-Renewable Subscription"
20
+
21
+ # A product that allows users to purchase a service with a limited duration.
22
+ READABLE_NON_RENEWING_SUBSCRIPTION = "Non-Renewing Subscription"
23
+
24
+ # Get the iap type matching based on a string (given by iTunes Connect)
25
+ def self.get_from_string(text)
26
+ mapping = {
27
+ 'ITC.addons.type.consumable' => READABLE_CONSUMABLE,
28
+ 'ITC.addons.type.nonConsumable' => READABLE_NON_CONSUMABLE,
29
+ 'ITC.addons.type.recurring' => READABLE_AUTO_RENEWABLE_SUBSCRIPTION,
30
+ 'ITC.addons.type.subscription' => READABLE_NON_RENEWING_SUBSCRIPTION,
31
+ 'consumable' => READABLE_CONSUMABLE,
32
+ 'nonConsumable' => READABLE_NON_CONSUMABLE,
33
+ 'recurring' => READABLE_AUTO_RENEWABLE_SUBSCRIPTION,
34
+ 'subscription' => READABLE_NON_RENEWING_SUBSCRIPTION
35
+ }
36
+
37
+ mapping.each do |itc_type, readable_type|
38
+ return readable_type if itc_type == text
39
+ end
40
+
41
+ return nil
42
+ end
43
+ end
44
+ end
45
+ end
@@ -1,5 +1,6 @@
1
1
  require 'spaceship/tunes/tunes_base'
2
2
  require 'spaceship/tunes/application'
3
+ require 'spaceship/tunes/iap'
3
4
  require 'spaceship/tunes/version_set'
4
5
  require 'spaceship/tunes/app_version'
5
6
  require 'spaceship/tunes/app_version_common'
@@ -1,5 +1,4 @@
1
1
  require "securerandom"
2
-
3
2
  module Spaceship
4
3
  # rubocop:disable Metrics/ClassLength
5
4
  class TunesClient < Spaceship::Client
@@ -590,6 +589,14 @@ module Spaceship
590
589
  du_client.upload_watch_icon(app_version, upload_image, content_provider_id, sso_token_for_image)
591
590
  end
592
591
 
592
+ # Uploads an In-App-Purchase Review screenshot
593
+ # @param app_id (AppId): The id of the app
594
+ # @param upload_image (UploadFile): The icon to upload
595
+ # @return [JSON] the response
596
+ def upload_purchase_review_screenshot(app_id, upload_image)
597
+ du_client.upload_purchase_review_screenshot(app_id, upload_image, content_provider_id, sso_token_for_image)
598
+ end
599
+
593
600
  # Uploads a screenshot
594
601
  # @param app_version (AppVersion): The version of your app
595
602
  # @param upload_image (UploadFile): The image to upload
@@ -970,6 +977,161 @@ module Spaceship
970
977
  parse_response(r, 'data')
971
978
  end
972
979
 
980
+ #####################################################
981
+ # @!group in-app-purchases
982
+ #####################################################
983
+
984
+ # Returns list of all available In-App-Purchases
985
+ def iaps(app_id: nil)
986
+ r = request(:get, "ra/apps/#{app_id}/iaps")
987
+ return r.body["data"]
988
+ end
989
+
990
+ # Returns list of all available Families
991
+ def iap_families(app_id: nil)
992
+ r = request(:get, "ra/apps/#{app_id}/iaps/families")
993
+ return r.body["data"]
994
+ end
995
+
996
+ # Deletes a In-App-Purchases
997
+ def delete_iap!(app_id: nil, purchase_id: nil)
998
+ r = request(:delete, "ra/apps/#{app_id}/iaps/#{purchase_id}")
999
+ handle_itc_response(r)
1000
+ end
1001
+
1002
+ # loads the full In-App-Purchases
1003
+ def load_iap(app_id: nil, purchase_id: nil)
1004
+ r = request(:get, "ra/apps/#{app_id}/iaps/#{purchase_id}")
1005
+ parse_response(r, 'data')
1006
+ end
1007
+
1008
+ # loads the full In-App-Purchases-Family
1009
+ def load_iap_family(app_id: nil, family_id: nil)
1010
+ r = request(:get, "ra/apps/#{app_id}/iaps/family/#{family_id}")
1011
+ parse_response(r, 'data')
1012
+ end
1013
+
1014
+ # updates an In-App-Purchases-Family
1015
+ def update_iap_family!(app_id: nil, family_id: nil, data: nil)
1016
+ with_tunes_retry do
1017
+ r = request(:put) do |req|
1018
+ req.url "ra/apps/#{app_id}/iaps/family/#{family_id}/"
1019
+ req.body = data.to_json
1020
+ req.headers['Content-Type'] = 'application/json'
1021
+ end
1022
+ handle_itc_response(r.body)
1023
+ end
1024
+ end
1025
+
1026
+ # updates an In-App-Purchases
1027
+ def update_iap!(app_id: nil, purchase_id: nil, data: nil)
1028
+ with_tunes_retry do
1029
+ r = request(:put) do |req|
1030
+ req.url "ra/apps/#{app_id}/iaps/#{purchase_id}"
1031
+ req.body = data.to_json
1032
+ req.headers['Content-Type'] = 'application/json'
1033
+ end
1034
+ handle_itc_response(r.body)
1035
+ end
1036
+ end
1037
+
1038
+ def create_iap_family(app_id: nil, name: nil, product_id: nil, reference_name: nil, versions: [])
1039
+ r = request(:get, "ra/apps/#{app_id}/iaps/family/template")
1040
+ data = parse_response(r, 'data')
1041
+
1042
+ data['activeAddOns'][0]['productId'] = { value: product_id }
1043
+ data['activeAddOns'][0]['referenceName'] = { value: reference_name }
1044
+ data['name'] = { value: name }
1045
+ data["details"]["value"] = versions
1046
+
1047
+ r = request(:post) do |req|
1048
+ req.url "ra/apps/#{app_id}/iaps/family/"
1049
+ req.body = data.to_json
1050
+ req.headers['Content-Type'] = 'application/json'
1051
+ end
1052
+ handle_itc_response(r.body)
1053
+ end
1054
+
1055
+ # returns pricing goal array
1056
+ def iap_subscription_pricing_target(app_id: nil, purchase_id: nil, currency:, tier:)
1057
+ r = request(:get, "ra/apps/#{app_id}/iaps/#{purchase_id}/pricing/equalize/#{currency}/#{tier}")
1058
+ parse_response(r, 'data')
1059
+ end
1060
+
1061
+ # Creates an In-App-Purchases
1062
+ def create_iap!(app_id: nil, type: nil, versions: nil, reference_name: nil, product_id: nil, cleared_for_sale: true, review_notes: nil, review_screenshot: nil, pricing_intervals: nil, family_id: nil, subscription_duration: nil, subscription_free_trial: nil)
1063
+ # Load IAP Template based on Type
1064
+ type ||= "consumable"
1065
+ r = request(:get, "ra/apps/#{app_id}/iaps/#{type}/template")
1066
+ data = parse_response(r, 'data')
1067
+
1068
+ # Now fill in the values we have
1069
+ # some values are nil, that's why there is a hash
1070
+ data['familyId'] = family_id.to_s if family_id
1071
+ data['productId'] = { value: product_id }
1072
+ data['referenceName'] = { value: reference_name }
1073
+ data['clearedForSale'] = { value: cleared_for_sale }
1074
+
1075
+ data['pricingDurationType'] = { value: subscription_duration } if subscription_duration
1076
+ data['freeTrialDurationType'] = { value: subscription_free_trial } if subscription_free_trial
1077
+
1078
+ # pricing tier
1079
+ if pricing_intervals
1080
+ data['pricingIntervals'] = []
1081
+ pricing_intervals.each do |interval|
1082
+ data['pricingIntervals'] << {
1083
+ value: {
1084
+ country: interval[:country] || "WW",
1085
+ tierStem: interval[:tier].to_s,
1086
+ priceTierEndDate: interval[:end_date],
1087
+ priceTierEffectiveDate: interval[:begin_date]
1088
+ }
1089
+ }
1090
+ end
1091
+ end
1092
+
1093
+ versions_array = []
1094
+ versions.each do |k, v|
1095
+ versions_array << {
1096
+ value: {
1097
+ description: { value: v[:description] },
1098
+ name: { value: v[:name] },
1099
+ localeCode: k.to_s
1100
+ }
1101
+ }
1102
+ end
1103
+ data["versions"][0]["details"]["value"] = versions_array
1104
+ data['versions'][0]["reviewNotes"] = { value: review_notes }
1105
+
1106
+ if review_screenshot
1107
+ # Upload Screenshot:
1108
+ upload_file = UploadFile.from_path review_screenshot
1109
+ screenshot_data = upload_purchase_review_screenshot(app_id, upload_file)
1110
+ new_screenshot = {
1111
+ "value" => {
1112
+ "assetToken" => screenshot_data["token"],
1113
+ "sortOrder" => 0,
1114
+ "type" => "SortedScreenShot",
1115
+ "originalFileName" => upload_file.file_name,
1116
+ "size" => screenshot_data["length"],
1117
+ "height" => screenshot_data["height"],
1118
+ "width" => screenshot_data["width"],
1119
+ "checksum" => screenshot_data["md5"]
1120
+ }
1121
+ }
1122
+
1123
+ data["versions"][0]["reviewScreenshot"] = new_screenshot
1124
+ end
1125
+
1126
+ # Now send back the modified hash
1127
+ r = request(:post) do |req|
1128
+ req.url "ra/apps/#{app_id}/iaps"
1129
+ req.body = data.to_json
1130
+ req.headers['Content-Type'] = 'application/json'
1131
+ end
1132
+ handle_itc_response(r.body)
1133
+ end
1134
+
973
1135
  #####################################################
974
1136
  # @!group Testers
975
1137
  #####################################################
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.13.0
4
+ version: 2.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2017-01-30 00:00:00.000000000 Z
17
+ date: 2017-02-02 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: slack-notifier
@@ -205,19 +205,25 @@ dependencies:
205
205
  - !ruby/object:Gem::Version
206
206
  version: 2.0.0
207
207
  - !ruby/object:Gem::Dependency
208
- name: colored
208
+ name: colored2
209
209
  requirement: !ruby/object:Gem::Requirement
210
210
  requirements:
211
211
  - - ">="
212
212
  - !ruby/object:Gem::Version
213
- version: '0'
213
+ version: 3.1.1
214
+ - - "<"
215
+ - !ruby/object:Gem::Version
216
+ version: 4.0.0
214
217
  type: :runtime
215
218
  prerelease: false
216
219
  version_requirements: !ruby/object:Gem::Requirement
217
220
  requirements:
218
221
  - - ">="
219
222
  - !ruby/object:Gem::Version
220
- version: '0'
223
+ version: 3.1.1
224
+ - - "<"
225
+ - !ruby/object:Gem::Version
226
+ version: 4.0.0
221
227
  - !ruby/object:Gem::Dependency
222
228
  name: commander
223
229
  requirement: !ruby/object:Gem::Requirement
@@ -1207,6 +1213,8 @@ files:
1207
1213
  - spaceship/lib/spaceship/portal/app_service.rb
1208
1214
  - spaceship/lib/spaceship/portal/certificate.rb
1209
1215
  - spaceship/lib/spaceship/portal/device.rb
1216
+ - spaceship/lib/spaceship/portal/person.rb
1217
+ - spaceship/lib/spaceship/portal/persons.rb
1210
1218
  - spaceship/lib/spaceship/portal/portal.rb
1211
1219
  - spaceship/lib/spaceship/portal/portal_base.rb
1212
1220
  - spaceship/lib/spaceship/portal/portal_client.rb
@@ -1234,6 +1242,14 @@ files:
1234
1242
  - spaceship/lib/spaceship/tunes/build_details.rb
1235
1243
  - spaceship/lib/spaceship/tunes/build_train.rb
1236
1244
  - spaceship/lib/spaceship/tunes/device_type.rb
1245
+ - spaceship/lib/spaceship/tunes/iap.rb
1246
+ - spaceship/lib/spaceship/tunes/iap_detail.rb
1247
+ - spaceship/lib/spaceship/tunes/iap_families.rb
1248
+ - spaceship/lib/spaceship/tunes/iap_family_details.rb
1249
+ - spaceship/lib/spaceship/tunes/iap_family_list.rb
1250
+ - spaceship/lib/spaceship/tunes/iap_list.rb
1251
+ - spaceship/lib/spaceship/tunes/iap_status.rb
1252
+ - spaceship/lib/spaceship/tunes/iap_type.rb
1237
1253
  - spaceship/lib/spaceship/tunes/language_converter.rb
1238
1254
  - spaceship/lib/spaceship/tunes/language_item.rb
1239
1255
  - spaceship/lib/spaceship/tunes/member.rb