Module: Spaceship::ConnectAPI::TestFlight::API

Defined in:
spaceship/lib/spaceship/connect_api/testflight/testflight.rb

Defined Under Namespace

Modules: Version

Instance Method Summary collapse

Instance Method Details

#add_beta_groups_to_build(build_id: nil, beta_group_ids: []) ⇒ Object



185
186
187
188
189
190
191
192
193
194
195
196
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 185

def add_beta_groups_to_build(build_id: nil, beta_group_ids: [])
  body = {
    data: beta_group_ids.map do |id|
      {
        type: "betaGroups",
        id: id
      }
    end
  }

  test_flight_request_client.post("#{Version::V1}/builds/#{build_id}/relationships/betaGroups", body)
end

#add_beta_tester_to_builds(beta_tester_id: nil, build_ids: []) ⇒ Object



377
378
379
380
381
382
383
384
385
386
387
388
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 377

def add_beta_tester_to_builds(beta_tester_id: nil, build_ids: [])
  body = {
    data: build_ids.map do |id|
      {
        type: "builds",
        id: id
      }
    end
  }

  test_flight_request_client.post("#{Version::V1}/betaTesters/#{beta_tester_id}/relationships/builds", body)
end

#add_beta_tester_to_group(beta_group_id: nil, beta_tester_ids: nil) ⇒ Object



325
326
327
328
329
330
331
332
333
334
335
336
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 325

def add_beta_tester_to_group(beta_group_id: nil, beta_tester_ids: nil)
  beta_tester_ids || []
  body = {
    data: beta_tester_ids.map do |id|
      {
        type: "betaTesters",
        id: id
      }
    end
  }
  test_flight_request_client.post("#{Version::V1}/betaGroups/#{beta_group_id}/relationships/betaTesters", body)
end

#add_beta_testers_to_build(build_id: nil, beta_tester_ids: []) ⇒ Object



390
391
392
393
394
395
396
397
398
399
400
401
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 390

def add_beta_testers_to_build(build_id: nil, beta_tester_ids: [])
  body = {
    data: beta_tester_ids.map do |id|
      {
        type: "betaTesters",
        id: id
      }
    end
  }

  test_flight_request_client.post("#{Version::V1}/builds/#{build_id}/relationships/individualTesters", body)
end

#create_beta_group(app_id: nil, group_name: nil, is_internal_group: false, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false, has_access_to_all_builds: nil) ⇒ Object



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 211

def create_beta_group(app_id: nil, group_name: nil, is_internal_group: false, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false, has_access_to_all_builds: nil)
  if is_internal_group
    has_access_to_all_builds = true if has_access_to_all_builds.nil?
  else
    # Access to all builds is only for internal groups
    has_access_to_all_builds = nil
  end
  body = {
    data: {
      attributes: {
        name: group_name,
        isInternalGroup: is_internal_group,
        hasAccessToAllBuilds: has_access_to_all_builds, # Undocumented of 2021-08-02 in ASC API docs and ASC Open API spec. This is the default behavior on App Store Connect and does work with both Apple ID and API Token
        publicLinkEnabled: public_link_enabled,
        publicLinkLimit: public_link_limit,
        publicLinkLimitEnabled: public_link_limit_enabled
      },
      relationships: {
        app: {
          data: {
            id: app_id,
            type: "apps"
          },
        },
      },
      type: "betaGroups",
    },
  }
  test_flight_request_client.post("#{Version::V1}/betaGroups", body)
end

#delete_beta_app_review_submission(beta_app_review_submission_id: nil) ⇒ Object



122
123
124
125
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 122

def delete_beta_app_review_submission(beta_app_review_submission_id: nil)
  params = test_flight_request_client.build_params(filter: nil, includes: nil, limit: nil, sort: nil, cursor: nil)
  test_flight_request_client.delete("#{Version::V1}/betaAppReviewSubmissions/#{beta_app_review_submission_id}", params)
end

#delete_beta_feedback(feedback_id: nil) ⇒ Object



515
516
517
518
519
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 515

def delete_beta_feedback(feedback_id: nil)
  raise "Feedback id is nil" if feedback_id.nil?

  test_flight_request_client.delete("#{Version::V1}/betaFeedbacks/#{feedback_id}")
end

#delete_beta_group(group_id: nil) ⇒ Object



254
255
256
257
258
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 254

def delete_beta_group(group_id: nil)
  raise "group_id is nil" if group_id.nil?

  test_flight_request_client.delete("#{Version::V1}/betaGroups/#{group_id}")
end

#delete_beta_groups_from_build(build_id: nil, beta_group_ids: []) ⇒ Object



198
199
200
201
202
203
204
205
206
207
208
209
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 198

def delete_beta_groups_from_build(build_id: nil, beta_group_ids: [])
  body = {
    data: beta_group_ids.map do |id|
      {
        type: "betaGroups",
        id: id
      }
    end
  }

  test_flight_request_client.delete("#{Version::V1}/builds/#{build_id}/relationships/betaGroups", nil, body)
end

#delete_beta_tester_from_apps(beta_tester_id: nil, app_ids: []) ⇒ Object



338
339
340
341
342
343
344
345
346
347
348
349
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 338

def delete_beta_tester_from_apps(beta_tester_id: nil, app_ids: [])
  body = {
    data: app_ids.map do |id|
      {
        type: "apps",
        id: id
      }
    end
  }

  test_flight_request_client.delete("#{Version::V1}/betaTesters/#{beta_tester_id}/relationships/apps", nil, body)
end

#delete_beta_tester_from_beta_groups(beta_tester_id: nil, beta_group_ids: []) ⇒ Object



351
352
353
354
355
356
357
358
359
360
361
362
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 351

def delete_beta_tester_from_beta_groups(beta_tester_id: nil, beta_group_ids: [])
  body = {
    data: beta_group_ids.map do |id|
      {
        type: "betaGroups",
        id: id
      }
    end
  }

  test_flight_request_client.delete("#{Version::V1}/betaTesters/#{beta_tester_id}/relationships/betaGroups", nil, body)
end

#delete_beta_testers_from_app(beta_tester_ids: [], app_id: nil) ⇒ Object



364
365
366
367
368
369
370
371
372
373
374
375
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 364

def delete_beta_testers_from_app(beta_tester_ids: [], app_id: nil)
  body = {
    data: beta_tester_ids.map do |id|
      {
        type: "betaTesters",
        id: id
      }
    end
  }

  test_flight_request_client.delete("#{Version::V1}/apps/#{app_id}/relationships/betaTesters", nil, body)
end

#delete_beta_testers_from_build(build_id: nil, beta_tester_ids: []) ⇒ Object



403
404
405
406
407
408
409
410
411
412
413
414
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 403

def delete_beta_testers_from_build(build_id: nil, beta_tester_ids: [])
  body = {
    data: beta_tester_ids.map do |id|
      {
        type: "betaTesters",
        id: id
      }
    end
  }

  test_flight_request_client.delete("#{Version::V1}/builds/#{build_id}/relationships/individualTesters", nil, body)
end

#get_app(app_id: nil, includes: nil) ⇒ Object



29
30
31
32
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 29

def get_app(app_id: nil, includes: nil)
  params = test_flight_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
  test_flight_request_client.get("#{Version::V1}/apps/#{app_id}", params)
end

#get_apps(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

apps



24
25
26
27
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 24

def get_apps(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/apps", params)
end

#get_beta_app_localizations(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

betaAppLocalizations



38
39
40
41
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 38

def get_beta_app_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/betaAppLocalizations", params)
end

#get_beta_app_review_detail(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

betaAppReviewDetails



78
79
80
81
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 78

def get_beta_app_review_detail(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/betaAppReviewDetails", params)
end

#get_beta_app_review_submissions(filter: {}, includes: nil, limit: nil, sort: nil, cursor: nil) ⇒ Object

betaAppReviewSubmissions



99
100
101
102
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 99

def get_beta_app_review_submissions(filter: {}, includes: nil, limit: nil, sort: nil, cursor: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort, cursor: cursor)
  test_flight_request_client.get("#{Version::V1}/betaAppReviewSubmissions", params)
end

#get_beta_build_localizations(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

betaBuildLocalizations



131
132
133
134
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 131

def get_beta_build_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/betaBuildLocalizations", params)
end

#get_beta_build_metrics(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

betaBuildMetrics



171
172
173
174
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 171

def get_beta_build_metrics(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/betaBuildMetrics", params)
end

#get_beta_feedback(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

betaFeedbacks (private API as of end 2019)



510
511
512
513
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 510

def get_beta_feedback(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/betaFeedbacks", params)
end

#get_beta_groups(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

betaGroups



180
181
182
183
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 180

def get_beta_groups(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/betaGroups", params)
end

#get_beta_tester_metrics(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

betaTesterMetrics



420
421
422
423
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 420

def get_beta_tester_metrics(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/betaTesterMetrics", params)
end

#get_beta_testers(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

betaTesters



270
271
272
273
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 270

def get_beta_testers(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/betaTesters", params)
end

#get_build(build_id: nil, app_store_version_id: nil, includes: nil) ⇒ Object



443
444
445
446
447
448
449
450
451
452
453
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 443

def get_build(build_id: nil, app_store_version_id: nil, includes: nil)
  if build_id
    params = test_flight_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
    return test_flight_request_client.get("#{Version::V1}/builds/#{build_id}", params)
  elsif app_store_version_id
    params = test_flight_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil, cursor: nil)
    return test_flight_request_client.get("#{Version::V1}/appStoreVersions/#{app_store_version_id}/build", params)
  else
    return nil
  end
end

#get_build_beta_details(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

buildBetaDetails



471
472
473
474
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 471

def get_build_beta_details(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/buildBetaDetails", params)
end

#get_build_bundles_build_bundle_file_sizes(build_bundle_id:, limit: nil) ⇒ Object

buildBundles



429
430
431
432
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 429

def get_build_bundles_build_bundle_file_sizes(build_bundle_id:, limit: nil)
  params = test_flight_request_client.build_params(filter: nil, includes: nil, limit: limit, sort: nil, cursor: nil)
  test_flight_request_client.get("#{Version::V1}/buildBundles/#{build_bundle_id}/buildBundleFileSizes", params)
end

#get_build_deliveries(app_id:, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

buildDeliveries



492
493
494
495
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 492

def get_build_deliveries(app_id:, filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/apps/#{app_id}/buildDeliveries", params)
end

#get_builds(filter: {}, includes: "buildBetaDetail,betaBuildMetrics", limit: 10, sort: "uploadedDate", cursor: nil) ⇒ Object

builds



438
439
440
441
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 438

def get_builds(filter: {}, includes: "buildBetaDetail,betaBuildMetrics", limit: 10, sort: "uploadedDate", cursor: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort, cursor: cursor)
  test_flight_request_client.get("#{Version::V1}/builds", params)
end

#get_builds_for_beta_group(group_id: nil) ⇒ Object



260
261
262
263
264
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 260

def get_builds_for_beta_group(group_id: nil)
  raise "group_id is nil" if group_id.nil?

  test_flight_request_client.get("#{Version::V1}/betaGroups/#{group_id}/builds")
end

#get_pre_release_versions(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

preReleaseVersions



501
502
503
504
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 501

def get_pre_release_versions(filter: {}, includes: nil, limit: nil, sort: nil)
  params = test_flight_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  test_flight_request_client.get("#{Version::V1}/preReleaseVersions", params)
end

#patch_beta_app_localizations(localization_id: nil, attributes: {}) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 62

def patch_beta_app_localizations(localization_id: nil, attributes: {})
  body = {
    data: {
      attributes: attributes,
      id: localization_id,
      type: "betaAppLocalizations"
    }
  }

  test_flight_request_client.patch("#{Version::V1}/betaAppLocalizations/#{localization_id}", body)
end

#patch_beta_app_review_detail(app_id: nil, attributes: {}) ⇒ Object



83
84
85
86
87
88
89
90
91
92
93
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 83

def patch_beta_app_review_detail(app_id: nil, attributes: {})
  body = {
    data: {
      attributes: attributes,
      id: app_id,
      type: "betaAppReviewDetails"
    }
  }

  test_flight_request_client.patch("#{Version::V1}/betaAppReviewDetails/#{app_id}", body)
end

#patch_beta_build_localizations(localization_id: nil, feedbackEmail: nil, attributes: {}) ⇒ Object



155
156
157
158
159
160
161
162
163
164
165
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 155

def patch_beta_build_localizations(localization_id: nil, feedbackEmail: nil, attributes: {})
  body = {
    data: {
      attributes: attributes,
      id: localization_id,
      type: "betaBuildLocalizations"
    }
  }

  test_flight_request_client.patch("#{Version::V1}/betaBuildLocalizations/#{localization_id}", body)
end

#patch_build_beta_details(build_beta_details_id: nil, attributes: {}) ⇒ Object



476
477
478
479
480
481
482
483
484
485
486
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 476

def patch_build_beta_details(build_beta_details_id: nil, attributes: {})
  body = {
    data: {
      attributes: attributes,
      id: build_beta_details_id,
      type: "buildBetaDetails"
    }
  }

  test_flight_request_client.patch("#{Version::V1}/buildBetaDetails/#{build_beta_details_id}", body)
end

#patch_builds(build_id: nil, attributes: {}) ⇒ Object



455
456
457
458
459
460
461
462
463
464
465
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 455

def patch_builds(build_id: nil, attributes: {})
  body = {
    data: {
      attributes: attributes,
      id: build_id,
      type: "builds"
    }
  }

  test_flight_request_client.patch("#{Version::V1}/builds/#{build_id}", body)
end

#patch_group(group_id: nil, attributes: {}) ⇒ Object



242
243
244
245
246
247
248
249
250
251
252
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 242

def patch_group(group_id: nil, attributes: {})
  body = {
    data: {
      attributes: attributes,
      id: group_id,
      type: "betaGroups"
    }
  }

  test_flight_request_client.patch("#{Version::V1}/betaGroups/#{group_id}", body)
end

#post_beta_app_localizations(app_id: nil, attributes: {}) ⇒ Object



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 43

def post_beta_app_localizations(app_id: nil, attributes: {})
  body = {
    data: {
      attributes: attributes,
      type: "betaAppLocalizations",
      relationships: {
        app: {
          data: {
            type: "apps",
            id: app_id
          }
        }
      }
    }
  }

  test_flight_request_client.post("#{Version::V1}/betaAppLocalizations", body)
end

#post_beta_app_review_submissions(build_id: nil) ⇒ Object



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 104

def post_beta_app_review_submissions(build_id: nil)
  body = {
    data: {
      type: "betaAppReviewSubmissions",
      relationships: {
        build: {
          data: {
            type: "builds",
            id: build_id
          }
        }
      }
    }
  }

  test_flight_request_client.post("#{Version::V1}/betaAppReviewSubmissions", body)
end

#post_beta_build_localizations(build_id: nil, attributes: {}) ⇒ Object



136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 136

def post_beta_build_localizations(build_id: nil, attributes: {})
  body = {
    data: {
      attributes: attributes,
      type: "betaBuildLocalizations",
      relationships: {
        build: {
          data: {
            type: "builds",
            id: build_id
          }
        }
      }
    }
  }

  test_flight_request_client.post("#{Version::V1}/betaBuildLocalizations", body)
end

#post_beta_tester_assignment(beta_group_ids: [], attributes: {}) ⇒ Object

attributes - “”, firstName: “”, lastName: “”



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 304

def post_beta_tester_assignment(beta_group_ids: [], attributes: {})
  body = {
    data: {
      attributes: attributes,
      relationships: {
        betaGroups: {
          data: beta_group_ids.map do |id|
            {
              type: "betaGroups",
              id: id
            }
          end
        }
      },
      type: "betaTesters"
    }
  }

  test_flight_request_client.post("#{Version::V1}/betaTesters", body)
end

#post_bulk_beta_tester_assignments(beta_group_id: nil, beta_testers: nil) ⇒ Object

beta_testers - [“”, firstName: “”, lastName: “”]



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 276

def post_bulk_beta_tester_assignments(beta_group_id: nil, beta_testers: nil)
  beta_testers || []

  beta_testers.map do |tester|
    tester[:errors] = []
  end

  body = {
    data: {
      attributes: {
        betaTesters: beta_testers
      },
      relationships: {
        betaGroup: {
          data: {
            type: "betaGroups",
            id: beta_group_id
          }
        }
      },
      type: "bulkBetaTesterAssignments"
    }
  }

  test_flight_request_client.post("#{Version::V1}/bulkBetaTesterAssignments", body)
end

#test_flight_request_clientObject

Raises:

  • (TypeError)


15
16
17
18
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 15

def test_flight_request_client
  return @test_flight_request_client if @test_flight_request_client
  raise TypeError, "You need to instantiate this module with test_flight_request_client"
end

#test_flight_request_client=(test_flight_request_client) ⇒ Object



11
12
13
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 11

def test_flight_request_client=(test_flight_request_client)
  @test_flight_request_client = test_flight_request_client
end