spaceship/lib/spaceship/connect_api/models/profile.rb in fastlane_hotfix-2.165.1 vs spaceship/lib/spaceship/connect_api/models/profile.rb in fastlane_hotfix-2.187.0

- old
+ new

@@ -63,17 +63,19 @@ # # API # - def self.all(filter: {}, includes: nil, limit: nil, sort: nil) - resps = Spaceship::ConnectAPI.get_profiles(filter: filter, includes: includes).all_pages + def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) + client ||= Spaceship::ConnectAPI + resps = client.get_profiles(filter: filter, includes: includes).all_pages return resps.flat_map(&:to_models) end - def self.create(name: nil, profile_type: nil, bundle_id_id: nil, certificate_ids: nil, device_ids: nil, template_name: nil) - resp = Spaceship::ConnectAPI.post_profiles( + def self.create(client: nil, name: nil, profile_type: nil, bundle_id_id: nil, certificate_ids: nil, device_ids: nil, template_name: nil) + client ||= Spaceship::ConnectAPI + resp = client.post_profiles( bundle_id_id: bundle_id_id, certificates: certificate_ids, devices: device_ids, attributes: { name: name, @@ -82,16 +84,24 @@ } ) return resp.to_models.first end - def fetch_all_devices(filter: {}, includes: nil, sort: nil) - resps = Spaceship::ConnectAPI.get_devices(profile_id: id, filter: filter, includes: includes).all_pages + def fetch_all_devices(client: nil, filter: {}, includes: nil, sort: nil) + client ||= Spaceship::ConnectAPI + resps = client.get_devices(profile_id: id, filter: filter, includes: includes).all_pages return resps.flat_map(&:to_models) end - def delete! - return Spaceship::ConnectAPI.delete_profile(profile_id: id) + def fetch_all_certificates(client: nil, filter: {}, includes: nil, sort: nil) + client ||= Spaceship::ConnectAPI + resps = client.get_certificates(profile_id: id, filter: filter, includes: includes).all_pages + return resps.flat_map(&:to_models) + end + + def delete!(client: nil) + client ||= Spaceship::ConnectAPI + return client.delete_profile(profile_id: id) end end end end