fastlane 2.149.0 → 2.150.0.rc4

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