fastlane 2.148.0 → 2.150.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +86 -86
  3. data/deliver/lib/deliver.rb +0 -1
  4. data/deliver/lib/deliver/app_screenshot.rb +28 -27
  5. data/deliver/lib/deliver/options.rb +6 -11
  6. data/deliver/lib/deliver/runner.rb +7 -21
  7. data/deliver/lib/deliver/setup.rb +5 -30
  8. data/deliver/lib/deliver/submit_for_review.rb +155 -90
  9. data/deliver/lib/deliver/upload_metadata.rb +355 -143
  10. data/deliver/lib/deliver/upload_price_tier.rb +22 -8
  11. data/deliver/lib/deliver/upload_screenshots.rb +112 -37
  12. data/fastlane/lib/assets/s3_html_template.erb +1 -1
  13. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +42 -2
  14. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  15. data/fastlane/lib/fastlane/actions/docs/upload_to_app_store.md.erb +77 -96
  16. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +3 -2
  17. data/fastlane/lib/fastlane/actions/download_dsyms.rb +7 -1
  18. data/fastlane/lib/fastlane/actions/google_play_track_release_names.rb +74 -0
  19. data/fastlane/lib/fastlane/actions/hipchat.rb +1 -1
  20. data/fastlane/lib/fastlane/actions/set_changelog.rb +23 -20
  21. data/fastlane/lib/fastlane/actions/slack.rb +2 -2
  22. data/fastlane/lib/fastlane/actions/slather.rb +8 -1
  23. data/fastlane/lib/fastlane/actions/spm.rb +7 -0
  24. data/fastlane/lib/fastlane/actions/upload_symbols_to_crashlytics.rb +2 -33
  25. data/fastlane/lib/fastlane/documentation/actions_list.rb +1 -1
  26. data/fastlane/lib/fastlane/lane.rb +3 -3
  27. data/fastlane/lib/fastlane/plugins/plugin_manager.rb +1 -1
  28. data/fastlane/lib/fastlane/plugins/template/.github/workflows/test.yml +29 -0
  29. data/fastlane/lib/fastlane/swift_fastlane_function.rb +22 -5
  30. data/fastlane/lib/fastlane/version.rb +1 -1
  31. data/fastlane/swift/ControlCommand.swift +1 -0
  32. data/fastlane/swift/Deliverfile.swift +1 -1
  33. data/fastlane/swift/Fastlane.swift +79 -22
  34. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/xcshareddata/xcschemes/FastlaneRunner.xcscheme +3 -9
  35. data/fastlane/swift/Gymfile.swift +1 -1
  36. data/fastlane/swift/GymfileProtocol.swift +1 -1
  37. data/fastlane/swift/LaneFileProtocol.swift +2 -5
  38. data/fastlane/swift/Matchfile.swift +1 -1
  39. data/fastlane/swift/MatchfileProtocol.swift +1 -1
  40. data/fastlane/swift/Precheckfile.swift +1 -1
  41. data/fastlane/swift/RubyCommand.swift +29 -6
  42. data/fastlane/swift/RubyCommandable.swift +1 -0
  43. data/fastlane/swift/Runner.swift +85 -13
  44. data/fastlane/swift/Scanfile.swift +1 -1
  45. data/fastlane/swift/ScanfileProtocol.swift +2 -2
  46. data/fastlane/swift/Screengrabfile.swift +1 -1
  47. data/fastlane/swift/Snapshotfile.swift +1 -1
  48. data/fastlane/swift/SnapshotfileProtocol.swift +9 -1
  49. data/fastlane/swift/SocketClient.swift +76 -45
  50. data/fastlane/swift/SocketClientDelegateProtocol.swift +1 -1
  51. data/fastlane/swift/SocketResponse.swift +1 -0
  52. data/fastlane_core/lib/fastlane_core/configuration/config_item.rb +1 -3
  53. data/fastlane_core/lib/fastlane_core/pkg_file_analyser.rb +7 -0
  54. data/frameit/lib/frameit/device_types.rb +100 -100
  55. data/gym/lib/gym/options.rb +1 -1
  56. data/match/lib/match/nuke.rb +21 -16
  57. data/match/lib/match/storage/git_storage.rb +4 -0
  58. data/match/lib/match/storage/google_cloud_storage.rb +4 -0
  59. data/match/lib/match/storage/interface.rb +4 -0
  60. data/match/lib/match/storage/s3_storage.rb +4 -0
  61. data/produce/lib/produce/itunes_connect.rb +32 -21
  62. data/produce/lib/produce/options.rb +3 -3
  63. data/scan/lib/scan/options.rb +1 -1
  64. data/scan/lib/scan/test_result_parser.rb +9 -2
  65. data/sigh/lib/assets/resign.sh +7 -7
  66. data/snapshot/lib/assets/SnapshotHelper.swift +5 -5
  67. data/snapshot/lib/assets/SnapshotHelperXcode8.swift +3 -3
  68. data/snapshot/lib/snapshot/options.rb +11 -1
  69. data/snapshot/lib/snapshot/reports_generator.rb +8 -1
  70. data/snapshot/lib/snapshot/test_command_generator.rb +8 -3
  71. data/spaceship/lib/spaceship/.DS_Store +0 -0
  72. data/spaceship/lib/spaceship/client.rb +13 -4
  73. data/spaceship/lib/spaceship/connect_api.rb +25 -2
  74. data/spaceship/lib/spaceship/connect_api/client.rb +97 -31
  75. data/spaceship/lib/spaceship/connect_api/file_uploader.rb +66 -0
  76. data/spaceship/lib/spaceship/connect_api/model.rb +1 -1
  77. data/spaceship/lib/spaceship/connect_api/models/age_rating_declaration.rb +113 -0
  78. data/spaceship/lib/spaceship/connect_api/models/app.rb +117 -3
  79. data/spaceship/lib/spaceship/connect_api/models/app_category.rb +94 -0
  80. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +66 -0
  81. data/spaceship/lib/spaceship/connect_api/models/app_info_localization.rb +38 -0
  82. data/spaceship/lib/spaceship/connect_api/models/app_preview.rb +77 -0
  83. data/spaceship/lib/spaceship/connect_api/models/app_preview_set.rb +71 -0
  84. data/spaceship/lib/spaceship/connect_api/models/app_price.rb +22 -0
  85. data/spaceship/lib/spaceship/connect_api/models/app_price_tier.rb +12 -0
  86. data/spaceship/lib/spaceship/connect_api/models/app_review_attachment.rb +81 -0
  87. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +97 -0
  88. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +101 -0
  89. data/spaceship/lib/spaceship/connect_api/models/app_store_review_detail.rb +51 -0
  90. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +182 -0
  91. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +86 -0
  92. data/spaceship/lib/spaceship/connect_api/models/app_store_version_phased_release.rb +36 -0
  93. data/spaceship/lib/spaceship/connect_api/models/app_store_version_submission.rb +26 -0
  94. data/spaceship/lib/spaceship/connect_api/models/build.rb +4 -0
  95. data/spaceship/lib/spaceship/connect_api/models/idfa_declaration.rb +40 -0
  96. data/spaceship/lib/spaceship/connect_api/models/reset_ratings_request.rb +26 -0
  97. data/spaceship/lib/spaceship/connect_api/models/territory.rb +27 -0
  98. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +10 -3
  99. data/spaceship/lib/spaceship/connect_api/tunes/client.rb +33 -0
  100. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +832 -0
  101. data/spaceship/lib/spaceship/errors.rb +3 -0
  102. data/spaceship/lib/spaceship/spaceauth_runner.rb +2 -2
  103. data/supply/lib/supply/client.rb +19 -0
  104. data/supply/lib/supply/reader.rb +16 -0
  105. metadata +50 -42
  106. data/deliver/lib/deliver/upload_assets.rb +0 -27
  107. data/snapshot/lib/snapshot/.options.rb.swp +0 -0
  108. data/snapshot/lib/snapshot/.test_command_generator_base.rb.swp +0 -0
@@ -0,0 +1,27 @@
1
+ require_relative '../model'
2
+ module Spaceship
3
+ class ConnectAPI
4
+ class Territory
5
+ include Spaceship::ConnectAPI::Model
6
+
7
+ attr_accessor :currency
8
+
9
+ attr_mapping({
10
+ "currency" => "currency"
11
+ })
12
+
13
+ def self.type
14
+ return "territories"
15
+ end
16
+
17
+ #
18
+ # API
19
+ #
20
+
21
+ def self.all(filter: {}, includes: nil, limit: 180, sort: nil)
22
+ resps = Spaceship::ConnectAPI.get_territories(filter: {}, includes: nil, limit: nil, sort: nil).all_pages
23
+ return resps.flat_map(&:to_models)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -285,9 +285,16 @@ module Spaceship
285
285
  Client.instance.get("builds", params)
286
286
  end
287
287
 
288
- def get_build(build_id: nil, includes: nil)
289
- params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
290
- Client.instance.get("builds/#{build_id}", params)
288
+ def get_build(build_id: nil, app_store_version_id: nil, includes: nil)
289
+ if build_id
290
+ params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
291
+ return Client.instance.get("builds/#{build_id}", params)
292
+ elsif app_store_version_id
293
+ params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
294
+ return Client.instance.get("appStoreVersions/#{app_store_version_id}/build", params)
295
+ else
296
+ return nil
297
+ end
291
298
  end
292
299
 
293
300
  def patch_builds(build_id: nil, attributes: {})
@@ -0,0 +1,33 @@
1
+ require_relative '../client'
2
+ require_relative '../../tunes/tunes_client'
3
+
4
+ module Spaceship
5
+ class ConnectAPI
6
+ module Tunes
7
+ class Client < Spaceship::ConnectAPI::Client
8
+ def self.instance
9
+ # Verify there is a token or a client that can be used
10
+ if Spaceship::ConnectAPI.token
11
+ if @client.nil? || @client.token != Spaceship::ConnectAPI.token
12
+ @client = Client.new(token: Spaceship::ConnectAPI.token)
13
+ end
14
+ elsif Spaceship::Tunes.client
15
+ # Initialize new client if new or if team changed
16
+ if @client.nil? || @client.team_id != Spaceship::Tunes.client.team_id
17
+ @client = Client.client_with_authorization_from(Spaceship::Tunes.client)
18
+ end
19
+ end
20
+
21
+ # Need to handle not having a client but this shouldn't ever happen
22
+ raise "Please login using `Spaceship::Tunes.login('user', 'password')`" unless @client
23
+
24
+ @client
25
+ end
26
+
27
+ def self.hostname
28
+ 'https://appstoreconnect.apple.com/iris/v1/'
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,832 @@
1
+ require 'spaceship/connect_api/tunes/client'
2
+
3
+ module Spaceship
4
+ class ConnectAPI
5
+ module Tunes
6
+ #
7
+ # ageRatingDeclarations
8
+ #
9
+
10
+ def get_age_rating_declaration(app_store_version_id: nil)
11
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
12
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/ageRatingDeclaration", params)
13
+ end
14
+
15
+ def patch_age_rating_declaration(age_rating_declaration_id: nil, attributes: nil)
16
+ body = {
17
+ data: {
18
+ type: "ageRatingDeclarations",
19
+ id: age_rating_declaration_id,
20
+ attributes: attributes
21
+ }
22
+ }
23
+
24
+ Client.instance.patch("ageRatingDeclarations/#{age_rating_declaration_id}", body)
25
+ end
26
+
27
+ #
28
+ # app
29
+ #
30
+
31
+ def post_app(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, territory_ids: nil, available_in_new_territories: true)
32
+ included = []
33
+ included << {
34
+ type: "appInfos",
35
+ id: "${new-appInfo-id}",
36
+ relationships: {
37
+ appInfoLocalizations: {
38
+ data: [
39
+ {
40
+ type: "appInfoLocalizations",
41
+ id: "${new-appInfoLocalization-id}"
42
+ }
43
+ ]
44
+ }
45
+ }
46
+ }
47
+ included << {
48
+ type: "appInfoLocalizations",
49
+ id: "${new-appInfoLocalization-id}",
50
+ attributes: {
51
+ locale: primary_locale,
52
+ name: name
53
+ }
54
+ }
55
+
56
+ platforms.each do |platform|
57
+ included << {
58
+ type: "appStoreVersions",
59
+ id: "${store-version-#{platform}}",
60
+ attributes: {
61
+ platform: platform,
62
+ versionString: version_string
63
+ },
64
+ relationships: {
65
+ appStoreVersionLocalizations: {
66
+ data: [
67
+ {
68
+ type: "appStoreVersionLocalizations",
69
+ id: "${new-#{platform}VersionLocalization-id}"
70
+ }
71
+ ]
72
+ }
73
+ }
74
+ }
75
+
76
+ included << {
77
+ type: "appStoreVersionLocalizations",
78
+ id: "${new-#{platform}VersionLocalization-id}",
79
+ attributes: {
80
+ locale: primary_locale
81
+ }
82
+ }
83
+ end
84
+
85
+ app_store_verions_data = platforms.map do |platform|
86
+ {
87
+ type: "appStoreVersions",
88
+ id: "${store-version-#{platform}}"
89
+ }
90
+ end
91
+
92
+ relationships = {
93
+ appStoreVersions: {
94
+ data: app_store_verions_data
95
+ },
96
+ appInfos: {
97
+ data: [
98
+ {
99
+ type: "appInfos",
100
+ id: "${new-appInfo-id}"
101
+ }
102
+ ]
103
+ }
104
+ }
105
+
106
+ body = {
107
+ data: {
108
+ type: "apps",
109
+ attributes: {
110
+ sku: sku,
111
+ primaryLocale: primary_locale,
112
+ bundleId: bundle_id,
113
+ availableInNewTerritories: !!available_in_new_territories
114
+ },
115
+ relationships: relationships
116
+ },
117
+ included: included
118
+ }
119
+
120
+ Client.instance.post("apps", body)
121
+ end
122
+
123
+ def patch_app(app_id: nil, attributes: {}, app_price_tier_id: nil, territory_ids: nil)
124
+ relationships = {}
125
+ included = []
126
+
127
+ # Price tier
128
+ unless app_price_tier_id.nil?
129
+ relationships[:prices] = {
130
+ data: [
131
+ {
132
+ type: "appPrices",
133
+ id: "${price1}"
134
+ }
135
+ ]
136
+ }
137
+
138
+ included << {
139
+ type: "appPrices",
140
+ id: "${price1}",
141
+ attributes: {
142
+ startDate: nil
143
+ },
144
+ relationships: {
145
+ app: {
146
+ data: {
147
+ type: "apps",
148
+ id: app_id
149
+ }
150
+ },
151
+ priceTier: {
152
+ data: {
153
+ type: "appPriceTiers",
154
+ id: app_price_tier_id.to_s
155
+ }
156
+ }
157
+ }
158
+ }
159
+ end
160
+
161
+ # Territories
162
+ territories_data = (territory_ids || []).map do |id|
163
+ { type: "territories", id: id }
164
+ end
165
+ unless territories_data.empty?
166
+ relationships[:availableTerritories] = {
167
+ data: territories_data
168
+ }
169
+ end
170
+
171
+ # Data
172
+ data = {
173
+ type: "apps",
174
+ id: app_id
175
+ }
176
+ data[:attributes] = attributes unless attributes.empty?
177
+ data[:relationships] = relationships unless relationships.empty?
178
+
179
+ # Body
180
+ body = {
181
+ data: data
182
+ }
183
+ body[:included] = included unless included.empty?
184
+
185
+ Client.instance.patch("apps/#{app_id}", body)
186
+ end
187
+
188
+ #
189
+ # appPreview
190
+ #
191
+
192
+ def post_app_preview(app_preview_set_id: nil, attributes: {})
193
+ body = {
194
+ data: {
195
+ type: "appPreviews",
196
+ attributes: attributes,
197
+ relationships: {
198
+ appPreviewSet: {
199
+ data: {
200
+ type: "appPreviewSets",
201
+ id: app_preview_set_id
202
+ }
203
+ }
204
+ }
205
+ }
206
+ }
207
+
208
+ Client.instance.post("appPreviews", body)
209
+ end
210
+
211
+ def patch_app_preview(app_preview_id: nil, attributes: {})
212
+ body = {
213
+ data: {
214
+ type: "appPreviews",
215
+ id: app_preview_id,
216
+ attributes: attributes
217
+ }
218
+ }
219
+
220
+ Client.instance.patch("appPreviews/#{app_preview_id}", body)
221
+ end
222
+
223
+ def delete_app_preview(app_preview_id: nil)
224
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
225
+ Client.instance.delete("appPreviews/#{app_preview_id}", params)
226
+ end
227
+
228
+ #
229
+ # appPreviewSets
230
+ #
231
+
232
+ def get_app_preview_sets(filter: {}, includes: nil, limit: nil, sort: nil)
233
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
234
+ Client.instance.get("appPreviewSets", params)
235
+ end
236
+
237
+ def post_app_preview_set(app_store_version_localization_id: nil, attributes: {})
238
+ body = {
239
+ data: {
240
+ type: "appPreviewSets",
241
+ attributes: attributes,
242
+ relationships: {
243
+ appStoreVersionLocalization: {
244
+ data: {
245
+ type: "appStoreVersionLocalizations",
246
+ id: app_store_version_localization_id
247
+ }
248
+ }
249
+ }
250
+ }
251
+ }
252
+
253
+ Client.instance.post("appPreviewSets", body)
254
+ end
255
+
256
+ #
257
+ # appPrices
258
+ #
259
+
260
+ def get_app_prices(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
261
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
262
+ Client.instance.get("appPrices", params)
263
+ end
264
+
265
+ #
266
+ # appReviewAttachments
267
+ #
268
+
269
+ def get_app_review_attachments(app_store_review_detail_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
270
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
271
+ Client.instance.get("appStoreReviewDetails/#{app_store_review_detail_id}/appReviewAttachments", params)
272
+ end
273
+
274
+ def post_app_review_attachment(app_store_review_detail_id: nil, attributes: {})
275
+ body = {
276
+ data: {
277
+ type: "appReviewAttachments",
278
+ attributes: attributes,
279
+ relationships: {
280
+ appStoreReviewDetail: {
281
+ data: {
282
+ type: "appStoreReviewDetails",
283
+ id: app_store_review_detail_id
284
+ }
285
+ }
286
+ }
287
+ }
288
+ }
289
+
290
+ Client.instance.post("appReviewAttachments", body)
291
+ end
292
+
293
+ def patch_app_review_attachment(app_review_attachment_id: nil, attributes: {})
294
+ body = {
295
+ data: {
296
+ type: "appReviewAttachments",
297
+ id: app_review_attachment_id,
298
+ attributes: attributes
299
+ }
300
+ }
301
+
302
+ Client.instance.patch("appReviewAttachments/#{app_review_attachment_id}", body)
303
+ end
304
+
305
+ def delete_app_review_attachment(app_review_attachment_id: nil)
306
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
307
+ Client.instance.delete("appReviewAttachments/#{app_review_attachment_id}", params)
308
+ end
309
+
310
+ #
311
+ # appScreenshotSets
312
+ #
313
+
314
+ def get_app_screenshot_sets(filter: {}, includes: nil, limit: nil, sort: nil)
315
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
316
+ Client.instance.get("appScreenshotSets", params)
317
+ end
318
+
319
+ def post_app_screenshot_set(app_store_version_localization_id: nil, attributes: {})
320
+ body = {
321
+ data: {
322
+ type: "appScreenshotSets",
323
+ attributes: attributes,
324
+ relationships: {
325
+ appStoreVersionLocalization: {
326
+ data: {
327
+ type: "appStoreVersionLocalizations",
328
+ id: app_store_version_localization_id
329
+ }
330
+ }
331
+ }
332
+ }
333
+ }
334
+
335
+ Client.instance.post("appScreenshotSets", body)
336
+ end
337
+
338
+ #
339
+ # appScreenshots
340
+ #
341
+
342
+ def post_app_screenshot(app_screenshot_set_id: nil, attributes: {})
343
+ body = {
344
+ data: {
345
+ type: "appScreenshots",
346
+ attributes: attributes,
347
+ relationships: {
348
+ appScreenshotSet: {
349
+ data: {
350
+ type: "appScreenshotSets",
351
+ id: app_screenshot_set_id
352
+ }
353
+ }
354
+ }
355
+ }
356
+ }
357
+
358
+ Client.instance.post("appScreenshots", body)
359
+ end
360
+
361
+ def patch_app_screenshot(app_screenshot_id: nil, attributes: {})
362
+ body = {
363
+ data: {
364
+ type: "appScreenshots",
365
+ id: app_screenshot_id,
366
+ attributes: attributes
367
+ }
368
+ }
369
+
370
+ Client.instance.patch("appScreenshots/#{app_screenshot_id}", body)
371
+ end
372
+
373
+ def delete_app_screenshot(app_screenshot_id: nil)
374
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
375
+ Client.instance.delete("appScreenshots/#{app_screenshot_id}", params)
376
+ end
377
+
378
+ #
379
+ # appInfos
380
+ #
381
+
382
+ def get_app_infos(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
383
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
384
+ Client.instance.get("apps/#{app_id}/appInfos", params)
385
+ end
386
+
387
+ def patch_app_info(app_info_id: nil, attributes: {})
388
+ attributes ||= {}
389
+
390
+ data = {
391
+ type: "appInfos",
392
+ id: app_info_id
393
+ }
394
+ data[:attributes] = attributes unless attributes.empty?
395
+
396
+ body = {
397
+ data: data
398
+ }
399
+
400
+ Client.instance.patch("appInfos/#{app_info_id}", body)
401
+ end
402
+
403
+ #
404
+ # Adding the key will create/update (if value) or delete if nil
405
+ # Not including a key will leave as is
406
+ # category_id_map: {
407
+ # primary_category_id: "GAMES",
408
+ # primary_subcategory_one_id: "PUZZLE",
409
+ # primary_subcategory_two_id: "STRATEGY",
410
+ # secondary_category_id: nil,
411
+ # secondary_subcategory_one_id: nil,
412
+ # secondary_subcategory_two_id: nil
413
+ # }
414
+ #
415
+ def patch_app_info_categories(app_info_id: nil, category_id_map: nil)
416
+ category_id_map ||= {}
417
+ primary_category_id = category_id_map[:primary_category_id]
418
+ primary_subcategory_one_id = category_id_map[:primary_subcategory_one_id]
419
+ primary_subcategory_two_id = category_id_map[:primary_subcategory_two_id]
420
+ secondary_category_id = category_id_map[:secondary_category_id]
421
+ secondary_subcategory_one_id = category_id_map[:secondary_subcategory_one_id]
422
+ secondary_subcategory_two_id = category_id_map[:secondary_subcategory_two_id]
423
+
424
+ relationships = {}
425
+
426
+ # Only update if key is included (otherwise category will be removed)
427
+ if category_id_map.include?(:primary_category_id)
428
+ relationships[:primaryCategory] = {
429
+ data: primary_category_id ? { type: "appCategories", id: primary_category_id } : nil
430
+ }
431
+ end
432
+
433
+ # Only update if key is included (otherwise category will be removed)
434
+ if category_id_map.include?(:primary_subcategory_one_id)
435
+ relationships[:primarySubcategoryOne] = {
436
+ data: primary_subcategory_one_id ? { type: "appCategories", id: primary_subcategory_one_id } : nil
437
+ }
438
+ end
439
+
440
+ # Only update if key is included (otherwise category will be removed)
441
+ if category_id_map.include?(:primary_subcategory_two_id)
442
+ relationships[:primarySubcategoryTwo] = {
443
+ data: primary_subcategory_two_id ? { type: "appCategories", id: primary_subcategory_two_id } : nil
444
+ }
445
+ end
446
+
447
+ # Only update if key is included (otherwise category will be removed)
448
+ if category_id_map.include?(:secondary_category_id)
449
+ relationships[:secondaryCategory] = {
450
+ data: secondary_category_id ? { type: "appCategories", id: secondary_category_id } : nil
451
+ }
452
+ end
453
+
454
+ # Only update if key is included (otherwise category will be removed)
455
+ if category_id_map.include?(:secondary_subcategory_one_id)
456
+ relationships[:secondarySubcategoryOne] = {
457
+ data: secondary_subcategory_one_id ? { type: "appCategories", id: secondary_subcategory_one_id } : nil
458
+ }
459
+ end
460
+
461
+ # Only update if key is included (otherwise category will be removed)
462
+ if category_id_map.include?(:secondary_subcategory_two_id)
463
+ relationships[:secondarySubcategoryTwo] = {
464
+ data: secondary_subcategory_two_id ? { type: "appCategories", id: secondary_subcategory_two_id } : nil
465
+ }
466
+ end
467
+
468
+ data = {
469
+ type: "appInfos",
470
+ id: app_info_id
471
+ }
472
+ data[:relationships] = relationships unless relationships.empty?
473
+
474
+ body = {
475
+ data: data
476
+ }
477
+
478
+ Client.instance.patch("appInfos/#{app_info_id}", body)
479
+ end
480
+
481
+ def delete_app_info(app_info_id: nil)
482
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
483
+ Client.instance.delete("appInfos/#{app_info_id}", params)
484
+ end
485
+
486
+ #
487
+ # appInfoLocalizations
488
+ #
489
+
490
+ def get_app_info_localizations(app_info_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
491
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
492
+ Client.instance.get("appInfos/#{app_info_id}/appInfoLocalizations", params)
493
+ end
494
+
495
+ def post_app_info_localization(app_info_id: nil, attributes: {})
496
+ body = {
497
+ data: {
498
+ type: "appInfoLocalizations",
499
+ attributes: attributes,
500
+ relationships: {
501
+ appStoreVersion: {
502
+ data: {
503
+ type: "appStoreVersions",
504
+ id: app_info_id
505
+ }
506
+ }
507
+ }
508
+ }
509
+ }
510
+
511
+ Client.instance.post("appInfoLocalizations", body)
512
+ end
513
+
514
+ def patch_app_info_localization(app_info_localization_id: nil, attributes: {})
515
+ body = {
516
+ data: {
517
+ type: "appInfoLocalizations",
518
+ id: app_info_localization_id,
519
+ attributes: attributes
520
+ }
521
+ }
522
+
523
+ Client.instance.patch("appInfoLocalizations/#{app_info_localization_id}", body)
524
+ end
525
+
526
+ #
527
+ # appStoreReviewDetails
528
+ #
529
+
530
+ def get_app_store_review_detail(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
531
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
532
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreReviewDetail", params)
533
+ end
534
+
535
+ def post_app_store_review_detail(app_store_version_id: nil, attributes: {})
536
+ body = {
537
+ data: {
538
+ type: "appStoreReviewDetails",
539
+ attributes: attributes,
540
+ relationships: {
541
+ appStoreVersion: {
542
+ data: {
543
+ type: "appStoreVersions",
544
+ id: app_store_version_id
545
+ }
546
+ }
547
+ }
548
+ }
549
+ }
550
+
551
+ Client.instance.post("appStoreReviewDetails", body)
552
+ end
553
+
554
+ def patch_app_store_review_detail(app_store_review_detail_id: nil, attributes: {})
555
+ body = {
556
+ data: {
557
+ type: "appStoreReviewDetails",
558
+ id: app_store_review_detail_id,
559
+ attributes: attributes
560
+ }
561
+ }
562
+
563
+ Client.instance.patch("appStoreReviewDetails/#{app_store_review_detail_id}", body)
564
+ end
565
+
566
+ #
567
+ # appStoreVersionLocalizations
568
+ #
569
+
570
+ def get_app_store_version_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
571
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
572
+ Client.instance.get("appStoreVersionLocalizations", params)
573
+ end
574
+
575
+ def post_app_store_version_localization(app_store_version_id: nil, attributes: {})
576
+ body = {
577
+ data: {
578
+ type: "appStoreVersionLocalizations",
579
+ attributes: attributes,
580
+ relationships: {
581
+ appStoreVersion: {
582
+ data: {
583
+ type: "appStoreVersions",
584
+ id: app_store_version_id
585
+ }
586
+ }
587
+ }
588
+ }
589
+ }
590
+
591
+ Client.instance.post("appStoreVersionLocalizations", body)
592
+ end
593
+
594
+ def patch_app_store_version_localization(app_store_version_localization_id: nil, attributes: {})
595
+ body = {
596
+ data: {
597
+ type: "appStoreVersionLocalizations",
598
+ id: app_store_version_localization_id,
599
+ attributes: attributes
600
+ }
601
+ }
602
+
603
+ Client.instance.patch("appStoreVersionLocalizations/#{app_store_version_localization_id}", body)
604
+ end
605
+
606
+ def delete_app_store_version_localization(app_store_version_localization_id: nil)
607
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
608
+ Client.instance.delete("appStoreVersionLocalizations/#{app_store_version_localization_id}", params)
609
+ end
610
+
611
+ #
612
+ # appStoreVersionPhasedReleases
613
+ #
614
+
615
+ def get_app_store_version_phased_release(app_store_version_id: nil)
616
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
617
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreVersionPhasedRelease", params)
618
+ end
619
+
620
+ def post_app_store_version_phased_release(app_store_version_id: nil, attributes: {})
621
+ body = {
622
+ data: {
623
+ type: "appStoreVersionPhasedReleases",
624
+ attributes: attributes,
625
+ relationships: {
626
+ appStoreVersion: {
627
+ data: {
628
+ type: "appStoreVersions",
629
+ id: app_store_version_id
630
+ }
631
+ }
632
+ }
633
+ }
634
+ }
635
+
636
+ Client.instance.post("appStoreVersionPhasedReleases", body)
637
+ end
638
+
639
+ def delete_app_store_version_phased_release(app_store_version_phased_release_id: nil)
640
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
641
+ Client.instance.delete("appStoreVersionPhasedReleases/#{app_store_version_phased_release_id}", params)
642
+ end
643
+
644
+ #
645
+ # appStoreVersions
646
+ #
647
+
648
+ def get_app_store_versions(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
649
+ params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
650
+ Client.instance.get("apps/#{app_id}/appStoreVersions", params)
651
+ end
652
+
653
+ def get_app_store_version(app_store_version_id: nil, includes: nil)
654
+ params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
655
+ Client.instance.get("appStoreVersions/#{app_store_version_id}", params)
656
+ end
657
+
658
+ def post_app_store_version(app_id: nil, attributes: {})
659
+ body = {
660
+ data: {
661
+ type: "appStoreVersions",
662
+ attributes: attributes,
663
+ relationships: {
664
+ app: {
665
+ data: {
666
+ type: "apps",
667
+ id: app_id
668
+ }
669
+ }
670
+ }
671
+ }
672
+ }
673
+
674
+ Client.instance.post("appStoreVersions", body)
675
+ end
676
+
677
+ def patch_app_store_version(app_store_version_id: nil, attributes: {})
678
+ body = {
679
+ data: {
680
+ type: "appStoreVersions",
681
+ id: app_store_version_id,
682
+ attributes: attributes
683
+ }
684
+ }
685
+
686
+ Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
687
+ end
688
+
689
+ def patch_app_store_version_with_build(app_store_version_id: nil, build_id: nil)
690
+ data = nil
691
+ if build_id
692
+ data = {
693
+ type: "builds",
694
+ id: build_id
695
+ }
696
+ end
697
+
698
+ body = {
699
+ data: {
700
+ type: "appStoreVersions",
701
+ id: app_store_version_id,
702
+ relationships: {
703
+ build: {
704
+ data: data
705
+ }
706
+ }
707
+ }
708
+ }
709
+
710
+ Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
711
+ end
712
+
713
+ #
714
+ # appStoreVersionPhasedReleases
715
+ #
716
+
717
+ def get_reset_ratings_request(app_store_version_id: nil)
718
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
719
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/resetRatingsRequest", params)
720
+ end
721
+
722
+ def post_reset_ratings_request(app_store_version_id: nil)
723
+ body = {
724
+ data: {
725
+ type: "resetRatingsRequests",
726
+ relationships: {
727
+ appStoreVersion: {
728
+ data: {
729
+ type: "appStoreVersions",
730
+ id: app_store_version_id
731
+ }
732
+ }
733
+ }
734
+ }
735
+ }
736
+
737
+ Client.instance.post("resetRatingsRequests", body)
738
+ end
739
+
740
+ def delete_reset_ratings_request(reset_ratings_request_id: nil)
741
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
742
+ Client.instance.delete("resetRatingsRequests/#{reset_ratings_request_id}", params)
743
+ end
744
+
745
+ #
746
+ # appStoreVersionSubmissions
747
+ #
748
+
749
+ def get_app_store_version_submission(app_store_version_id: nil)
750
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
751
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreVersionSubmission", params)
752
+ end
753
+
754
+ def post_app_store_version_submission(app_store_version_id: nil)
755
+ body = {
756
+ data: {
757
+ type: "appStoreVersionSubmissions",
758
+ relationships: {
759
+ appStoreVersion: {
760
+ data: {
761
+ type: "appStoreVersions",
762
+ id: app_store_version_id
763
+ }
764
+ }
765
+ }
766
+ }
767
+ }
768
+
769
+ Client.instance.post("appStoreVersionSubmissions", body)
770
+ end
771
+
772
+ def delete_app_store_version_submission(app_store_version_submission_id: nil)
773
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
774
+ Client.instance.delete("appStoreVersionSubmissions/#{app_store_version_submission_id}", params)
775
+ end
776
+
777
+ #
778
+ # idfaDeclarations
779
+ #
780
+
781
+ def get_idfa_declaration(app_store_version_id: nil)
782
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
783
+ Client.instance.get("appStoreVersions/#{app_store_version_id}/idfaDeclaration", params)
784
+ end
785
+
786
+ def post_idfa_declaration(app_store_version_id: nil, attributes: nil)
787
+ body = {
788
+ data: {
789
+ type: "idfaDeclarations",
790
+ attributes: attributes,
791
+ relationships: {
792
+ appStoreVersion: {
793
+ data: {
794
+ type: "appStoreVersions",
795
+ id: app_store_version_id
796
+ }
797
+ }
798
+ }
799
+ }
800
+ }
801
+
802
+ Client.instance.post("idfaDeclarations", body)
803
+ end
804
+
805
+ def patch_idfa_declaration(idfa_declaration_id: nil, attributes: nil)
806
+ body = {
807
+ data: {
808
+ type: "idfaDeclarations",
809
+ id: idfa_declaration_id,
810
+ attributes: attributes
811
+ }
812
+ }
813
+
814
+ Client.instance.patch("idfaDeclarations/#{idfa_declaration_id}", body)
815
+ end
816
+
817
+ def delete_idfa_declaration(idfa_declaration_id: nil)
818
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
819
+ Client.instance.delete("idfaDeclarations/#{idfa_declaration_id}", params)
820
+ end
821
+
822
+ #
823
+ # territories
824
+ #
825
+
826
+ def get_territories(filter: {}, includes: nil, limit: nil, sort: nil)
827
+ params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
828
+ Client.instance.get("territories", params)
829
+ end
830
+ end
831
+ end
832
+ end