spaceship/lib/spaceship/connect_api/models/beta_tester.rb in fastlane-2.167.0 vs spaceship/lib/spaceship/connect_api/models/beta_tester.rb in fastlane-2.168.0

- old
+ new

@@ -32,26 +32,30 @@ # # API # - def self.all(filter: {}, includes: nil, limit: nil, sort: nil) - resps = Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes).all_pages + def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) + client ||= Spaceship::ConnectAPI + resps = client.get_beta_testers(filter: filter, includes: includes).all_pages return resps.flat_map(&:to_models) end - def self.find(email: nil, includes: nil) - return all(filter: { email: email }, includes: includes).first + def self.find(client: nil, email: nil, includes: nil) + client ||= Spaceship::ConnectAPI + return all(client: client, filter: { email: email }, includes: includes).first end - def delete_from_apps(apps: nil) + def delete_from_apps(client: nil, apps: nil) + client ||= Spaceship::ConnectAPI app_ids = apps.map(&:id) - return Spaceship::ConnectAPI.delete_beta_tester_from_apps(beta_tester_id: id, app_ids: app_ids) + return client.delete_beta_tester_from_apps(beta_tester_id: id, app_ids: app_ids) end - def delete_from_beta_groups(beta_groups: nil) + def delete_from_beta_groups(client: nil, beta_groups: nil) + client ||= Spaceship::ConnectAPI beta_group_ids = beta_groups.map(&:id) - return Spaceship::ConnectAPI.delete_beta_tester_from_beta_groups(beta_tester_id: id, beta_group_ids: beta_group_ids) + return client.delete_beta_tester_from_beta_groups(beta_tester_id: id, beta_group_ids: beta_group_ids) end end end end