spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb in fastlane-2.156.1 vs spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb in fastlane-2.157.0

- old
+ new

@@ -1,89 +1,100 @@ require 'spaceship/connect_api/provisioning/client' module Spaceship class ConnectAPI module Provisioning - # - # bundleIds - # + module API + def provisioning_request_client=(provisioning_request_client) + @provisioning_request_client = provisioning_request_client + end - def get_bundle_ids(filter: {}, includes: nil, limit: nil, sort: nil) - params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort) - Client.instance.get("bundleIds", params) - end + def provisioning_request_client + return @provisioning_request_client if @provisioning_request_client + raise TypeError, "You need to instantiate this module with provisioning_request_client" + end - def get_bundle_id(bundle_id_id: {}, includes: nil) - params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil) - Client.instance.get("bundleIds/#{bundle_id_id}", params) - end + # + # bundleIds + # - # - # certificates - # + def get_bundle_ids(filter: {}, includes: nil, limit: nil, sort: nil) + params = provisioning_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort) + provisioning_request_client.get("bundleIds", params) + end - def get_certificates(filter: {}, includes: nil, limit: nil, sort: nil) - params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort) - Client.instance.get("certificates", params) - end + def get_bundle_id(bundle_id_id: {}, includes: nil) + params = provisioning_request_client.build_params(filter: nil, includes: includes, limit: nil, sort: nil) + provisioning_request_client.get("bundleIds/#{bundle_id_id}", params) + end - # - # devices - # + # + # certificates + # - def get_devices(filter: {}, includes: nil, limit: nil, sort: nil) - params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort) - Client.instance.get("devices", params) - end + def get_certificates(filter: {}, includes: nil, limit: nil, sort: nil) + params = provisioning_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort) + provisioning_request_client.get("certificates", params) + end - # - # profiles - # + # + # devices + # - def get_profiles(filter: {}, includes: nil, limit: nil, sort: nil) - params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort) - Client.instance.get("profiles", params) - end + def get_devices(filter: {}, includes: nil, limit: nil, sort: nil) + params = provisioning_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort) + provisioning_request_client.get("devices", params) + end - def post_profiles(bundle_id_id: nil, certificates: nil, devices: nil, attributes: {}) - body = { - data: { - attributes: attributes, - type: "profiles", - relationships: { - bundleId: { - data: { - type: "bundleIds", - id: bundle_id_id - } - }, - certificates: { - data: certificates.map do |certificate| - { - type: "certificates", - id: certificate + # + # profiles + # + + def get_profiles(filter: {}, includes: nil, limit: nil, sort: nil) + params = provisioning_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort) + provisioning_request_client.get("profiles", params) + end + + def post_profiles(bundle_id_id: nil, certificates: nil, devices: nil, attributes: {}) + body = { + data: { + attributes: attributes, + type: "profiles", + relationships: { + bundleId: { + data: { + type: "bundleIds", + id: bundle_id_id } - end - }, - devices: { - data: (devices || []).map do |device| - { - type: "devices", - id: device - } - end + }, + certificates: { + data: certificates.map do |certificate| + { + type: "certificates", + id: certificate + } + end + }, + devices: { + data: (devices || []).map do |device| + { + type: "devices", + id: device + } + end + } } } } - } - Client.instance.post("profiles", body) - end + provisioning_request_client.post("profiles", body) + end - def delete_profile(profile_id: nil) - raise "Profile id is nil" if profile_id.nil? + def delete_profile(profile_id: nil) + raise "Profile id is nil" if profile_id.nil? - Client.instance.delete("profiles/#{profile_id}") + provisioning_request_client.delete("profiles/#{profile_id}") + end end end end end