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

- old
+ new

@@ -73,30 +73,34 @@ # # API # - def self.all(filter: {}, includes: nil, limit: nil, sort: nil) - resps = Spaceship::ConnectAPI.get_certificates(filter: filter, includes: includes).all_pages + def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) + client ||= Spaceship::ConnectAPI + resps = client.get_certificates(filter: filter, includes: includes).all_pages return resps.flat_map(&:to_models) end - def self.create(certificate_type: nil, csr_content: nil) + def self.create(client: nil, certificate_type: nil, csr_content: nil) + client ||= Spaceship::ConnectAPI attributes = { certificateType: certificate_type, csrContent: csr_content } - resp = Spaceship::ConnectAPI.post_certificate(attributes: attributes) + resp = client.post_certificate(attributes: attributes) return resp.to_models.first end - def self.get(certificate_id: nil, includes: nil) - resp = Spaceship::ConnectAPI.get_certificate(certificate_id: certificate_id, includes: includes) + def self.get(client: nil, certificate_id: nil, includes: nil) + client ||= Spaceship::ConnectAPI + resp = client.get_certificate(certificate_id: certificate_id, includes: includes) return resp.to_models.first end - def delete! - Spaceship::ConnectAPI.delete_certificate(certificate_id: id) + def delete!(client: nil) + client ||= Spaceship::ConnectAPI + client.delete_certificate(certificate_id: id) end end end end