lib/spaceship/portal/provisioning_profile.rb in spaceship-0.3.1 vs lib/spaceship/portal/provisioning_profile.rb in spaceship-0.3.2
- old
+ new
@@ -215,15 +215,28 @@
# For Development and AdHoc we usually want all devices by default
devices = Spaceship::Device.all
end
end
- profile = client.create_provisioning_profile!(name,
- self.type,
- app.app_id,
- certificate_parameter,
- devices.map {|d| d.id} )
+ def send_create_request(name, type, app_id, certificate_parameter, devices)
+ tries ||= 5
+ client.create_provisioning_profile!(name, type, app_id, certificate_parameter, devices)
+ rescue => ex
+ unless (tries -= 1).zero?
+ sleep 3
+ retry
+ end
+
+ raise ex # re-raise the exception
+ end
+
+ profile = send_create_request(name,
+ self.type,
+ app.app_id,
+ certificate_parameter,
+ devices.map {|d| d.id} )
+
self.new(profile)
end
# @return (Array) Returns all profiles registered for this account
# If you're calling this from a subclass (like AdHoc), this will
@@ -324,10 +337,28 @@
else
self.certificates = [Spaceship::Certificate::Production.all.first]
end
end
- client.repair_provisioning_profile!(
+ def send_update_request(id, name, distribution_method, app_id, certificates, devices)
+ tries ||= 5
+ client.repair_provisioning_profile!(
+ id,
+ name,
+ distribution_method,
+ app_id,
+ certificates,
+ devices
+ )
+ rescue => ex
+ unless (tries -= 1).zero?
+ sleep 3
+ retry
+ end
+ raise ex # re-raise the exception
+ end
+
+ send_update_request(
self.id,
self.name,
self.distribution_method,
self.app.app_id,
self.certificates.map { |c| c.id },