class Spaceship::Portal::App

Represents an App ID from the Developer Portal

Attributes

app_groups_count[RW]

@return (Fixnum) Number of associated app groups

app_id[RW]

@return (String) The identifier of this app, provided by the Dev Portal @example

"RGAWZGXSAA"
associated_cloud_containers[RW]

@return (Array of Spaceship::Portal::CloudContainer) Associated cloud containers

associated_groups[RW]

@return (Array of Spaceship::Portal::AppGroup) Associated groups

bundle_id[RW]

@return (String) The bundle_id (app identifier) of your app @example

"com.krausefx.app"
cloud_containers_count[RW]

@return (Fixnum) Number of associated cloud containers

dev_push_enabled[RW]

@return (Bool) Development Push Enabled?

enable_services[RW]

@return (Array) List of enabled services

features[RW]

@return (Hash) Feature details

identifiers_count[RW]

@return (Fixnum) Number of associated identifiers

is_wildcard[RW]

@return (Bool) Is this app a wildcard app (e.g. com.krausefx.*)

name[RW]

@return (String) The name you provided for this app @example

"Spaceship"
platform[RW]

@return (String) the supported platform of this app @example

"ios"
prefix[RW]

Prefix provided by the Dev Portal @example

"5A997XSHK2"
prod_push_enabled[RW]

@return (Bool) Production Push Enabled?

Private Class Methods

all(mac: false) click to toggle source

@param mac [Bool] Fetches Mac apps if true @return (Array) Returns all apps available for this account

# File spaceship/lib/spaceship/portal/app.rb, line 84
def all(mac: false)
  client.apps(mac: mac).map { |app| self.new(app) }
end
create!(bundle_id: nil, name: nil, mac: false, enable_services: {}) click to toggle source

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

# File spaceship/lib/spaceship/portal/app.rb, line 95
def create!(bundle_id: nil, name: nil, mac: false, enable_services: {})
  if bundle_id.end_with?('*')
    type = :wildcard
  else
    type = :explicit
  end

  new_app = client.create_app!(type, name, bundle_id, mac: mac, enable_services: enable_services)
  self.new(new_app)
end
find(bundle_id, mac: false) click to toggle source

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.

# File spaceship/lib/spaceship/portal/app.rb, line 109
def find(bundle_id, mac: false)
  raise "`bundle_id` parameter must not be nil" if bundle_id.nil?
  found_app = all(mac: mac).find do |app|
    app if app.bundle_id.casecmp(bundle_id) == 0
  end

  # Find catalyst enabled mac apps (look for mac first and then iOS)
  if !found_app && mac
    found_app = all(mac: false).find do |app|
      app if app.bundle_id.casecmp(bundle_id) == 0
    end
  end

  found_app
end

Private Instance Methods

associate_cloud_containers(containers) click to toggle source

Associate specific iCloud Containers with this app @return (App) The updated detailed app. This is nil if the app couldn't be found.

# File spaceship/lib/spaceship/portal/app.rb, line 174
def associate_cloud_containers(containers)
  raise "`associate_cloud_containers` not available for Mac apps" if mac?
  app = client.associate_cloud_containers_with_app(self, containers)
  self.class.factory(app)
end
associate_groups(groups) click to toggle source

Associate specific groups with this app @return (App) The updated detailed app. This is nil if the app couldn't be found

# File spaceship/lib/spaceship/portal/app.rb, line 166
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
associate_merchants(merchants) click to toggle source

Associate specific merchants with this app @return (App) The updated detailed app. This is nil if the app couldn't be found

# File spaceship/lib/spaceship/portal/app.rb, line 182
def associate_merchants(merchants)
  app = client.associate_merchants_with_app(self, merchants, mac?)
  self.class.factory(app)
end
delete!() click to toggle source

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

# File spaceship/lib/spaceship/portal/app.rb, line 145
def delete!
  client.delete_app!(app_id, mac: mac?)
  self
end
details() click to toggle source

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.

# File spaceship/lib/spaceship/portal/app.rb, line 159
def details
  app = client.details_for_app(self)
  self.class.factory(app)
end
mac?() click to toggle source

@return (Bool) Is this a Mac app?

# File spaceship/lib/spaceship/portal/app.rb, line 196
def mac?
  platform == 'mac'
end
update_name!(name, mac: false) click to toggle source

Update name of this App ID. @return (App) The app you updated. This is nil if the app can't be found

# File spaceship/lib/spaceship/portal/app.rb, line 152
def update_name!(name, mac: false)
  app = client.update_app_name!(app_id, name, mac: mac)
  self.class.factory(app)
end
update_service(service) click to toggle source

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

# File spaceship/lib/spaceship/portal/app.rb, line 189
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