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

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

Instance Method Summary collapse

Instance Method Details

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



181
182
183
184
185
186
187
188
189
190
191
192
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 181

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("builds/#{build_id}/relationships/betaGroups", body)
end

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



373
374
375
376
377
378
379
380
381
382
383
384
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 373

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("betaTesters/#{beta_tester_id}/relationships/builds", body)
end

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



321
322
323
324
325
326
327
328
329
330
331
332
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 321

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("betaGroups/#{beta_group_id}/relationships/betaTesters", body)
end

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



386
387
388
389
390
391
392
393
394
395
396
397
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 386

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("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



207
208
209
210
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
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 207

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("betaGroups", body)
end

#delete_beta_app_review_submission(beta_app_review_submission_id: nil) ⇒ Object



118
119
120
121
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 118

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("betaAppReviewSubmissions/#{beta_app_review_submission_id}", params)
end

#delete_beta_feedback(feedback_id: nil) ⇒ Object



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

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

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

#delete_beta_group(group_id: nil) ⇒ Object



250
251
252
253
254
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 250

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

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

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



194
195
196
197
198
199
200
201
202
203
204
205
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 194

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("builds/#{build_id}/relationships/betaGroups", nil, body)
end

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



334
335
336
337
338
339
340
341
342
343
344
345
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 334

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("betaTesters/#{beta_tester_id}/relationships/apps", nil, body)
end

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



347
348
349
350
351
352
353
354
355
356
357
358
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 347

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("betaTesters/#{beta_tester_id}/relationships/betaGroups", nil, body)
end

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



360
361
362
363
364
365
366
367
368
369
370
371
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 360

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("apps/#{app_id}/relationships/betaTesters", nil, body)
end

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



399
400
401
402
403
404
405
406
407
408
409
410
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 399

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("builds/#{build_id}/relationships/individualTesters", nil, body)
end

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



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

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("apps/#{app_id}", params)
end

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

apps



20
21
22
23
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 20

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("apps", params)
end

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

betaAppLocalizations



34
35
36
37
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 34

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("betaAppLocalizations", params)
end

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

betaAppReviewDetails



74
75
76
77
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 74

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("betaAppReviewDetails", params)
end

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

betaAppReviewSubmissions



95
96
97
98
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 95

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("betaAppReviewSubmissions", params)
end

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

betaBuildLocalizations



127
128
129
130
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 127

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("betaBuildLocalizations", params)
end

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

betaBuildMetrics



167
168
169
170
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 167

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("betaBuildMetrics", params)
end

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

betaFeedbacks (private API as of end 2019)



506
507
508
509
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 506

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("betaFeedbacks", params)
end

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

betaGroups



176
177
178
179
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 176

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("betaGroups", params)
end

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

betaTesterMetrics



416
417
418
419
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 416

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("betaTesterMetrics", params)
end

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

betaTesters



266
267
268
269
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 266

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("betaTesters", params)
end

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



439
440
441
442
443
444
445
446
447
448
449
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 439

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("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("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



467
468
469
470
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 467

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("buildBetaDetails", params)
end

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

buildBundles



425
426
427
428
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 425

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("buildBundles/#{build_bundle_id}/buildBundleFileSizes", params)
end

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

buildDeliveries



488
489
490
491
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 488

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("apps/#{app_id}/buildDeliveries", params)
end

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

builds



434
435
436
437
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 434

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("builds", params)
end

#get_builds_for_beta_group(group_id: nil) ⇒ Object



256
257
258
259
260
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 256

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

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

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

preReleaseVersions



497
498
499
500
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 497

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("preReleaseVersions", params)
end

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



58
59
60
61
62
63
64
65
66
67
68
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 58

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

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

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



79
80
81
82
83
84
85
86
87
88
89
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 79

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

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

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



151
152
153
154
155
156
157
158
159
160
161
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 151

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("betaBuildLocalizations/#{localization_id}", body)
end

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



472
473
474
475
476
477
478
479
480
481
482
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 472

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("buildBetaDetails/#{build_beta_details_id}", body)
end

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



451
452
453
454
455
456
457
458
459
460
461
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 451

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

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

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



238
239
240
241
242
243
244
245
246
247
248
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 238

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

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

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



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 39

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("betaAppLocalizations", body)
end

#post_beta_app_review_submissions(build_id: nil) ⇒ Object



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 100

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("betaAppReviewSubmissions", body)
end

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



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 132

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("betaBuildLocalizations", body)
end

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

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



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 300

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("betaTesters", body)
end

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

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



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

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("bulkBetaTesterAssignments", body)
end

#test_flight_request_clientObject

Raises:

  • (TypeError)


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

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



7
8
9
# File 'spaceship/lib/spaceship/connect_api/testflight/testflight.rb', line 7

def test_flight_request_client=(test_flight_request_client)
  @test_flight_request_client = test_flight_request_client
end