lib/spaceship/portal/app.rb in spaceship-0.17.0 vs lib/spaceship/portal/app.rb in spaceship-0.18.0
- old
+ new
@@ -72,46 +72,49 @@
# This is used to create a new object based on the server response.
def factory(attrs)
self.new(attrs)
end
+ # @param mac [Bool] Fetches Mac apps if true
# @return (Array) Returns all apps available for this account
- def all
- client.apps.map { |app| self.factory(app) }
+ def all(mac: false)
+ client.apps(mac: mac).map { |app| self.factory(app) }
end
# Creates a new App ID on the Apple Dev Portal
#
# if bundle_id ends with '*' then it is a wildcard id otherwise, it is an explicit id
# @param bundle_id [String] the bundle id (app_identifier) of the app associated with this provisioning profile
# @param name [String] the name of the App
+ # @param mac [Bool] is this a Mac app?
# @return (App) The app you just created
- def create!(bundle_id: nil, name: nil)
+ def create!(bundle_id: nil, name: nil, mac: false)
if bundle_id.end_with?('*')
type = :wildcard
else
type = :explicit
end
- new_app = client.create_app!(type, name, bundle_id)
+ new_app = client.create_app!(type, name, bundle_id, mac: mac)
self.new(new_app)
end
# Find a specific App ID based on the bundle_id
+ # @param mac [Bool] Searches Mac apps if true
# @return (App) The app you're looking for. This is nil if the app can't be found.
- def find(bundle_id)
- all.find do |app|
+ def find(bundle_id, mac: false)
+ all(mac: mac).find do |app|
app.bundle_id == bundle_id
end
end
end
# Delete this App ID. This action will most likely fail if the App ID is already in the store
# or there are active profiles
# @return (App) The app you just deletd
def delete!
- client.delete_app!(app_id)
+ client.delete_app!(app_id, mac: mac?)
self
end
# Fetch a specific App ID details based on the bundle_id
# @return (App) The app you're looking for. This is nil if the app can't be found.
@@ -121,18 +124,25 @@
end
# Associate specific groups with this app
# @return (App) The updated detailed app. This is nil if the app couldn't be found
def associate_groups(groups)
+ raise "`associate_groups` not available for Mac apps" if mac?
app = client.associate_groups_with_app(self, groups)
self.class.factory(app)
end
# Update a service for the app with given AppService object
# @return (App) The updated detailed app. This is nil if the app couldn't be found
def update_service(service)
+ raise "`update_service` not implemented for Mac apps" if mac?
app = client.update_service_for_app(self, service)
self.class.factory(app)
+ end
+
+ # @return (Bool) Is this a Mac app?
+ def mac?
+ platform == 'mac'
end
end
end
end