Class: Spaceship::Portal::App

Inherits:
Spaceship::PortalBase show all
Defined in:
spaceship/lib/spaceship/portal/app.rb

Overview

Represents an App ID from the Developer Portal

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Spaceship::PortalBase

client

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, factory, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#app_groups_countFixnum

Returns Number of associated app groups.

Returns:

  • (Fixnum)

    Number of associated app groups



49
50
51
# File 'spaceship/lib/spaceship/portal/app.rb', line 49

def app_groups_count
  @app_groups_count
end

#app_idString

Returns The identifier of this app, provided by the Dev Portal.

Examples:

"RGAWZGXSAA"

Returns:

  • (String)

    The identifier of this app, provided by the Dev Portal



11
12
13
# File 'spaceship/lib/spaceship/portal/app.rb', line 11

def app_id
  @app_id
end

#associated_groupsArray of Spaceship::Portal::AppGroup

Returns Associated groups.

Returns:



58
59
60
# File 'spaceship/lib/spaceship/portal/app.rb', line 58

def associated_groups
  @associated_groups
end

#bundle_idString

Returns The bundle_id (app identifier) of your app.

Examples:

"com.krausefx.app"

Returns:

  • (String)

    The bundle_id (app identifier) of your app



31
32
33
# File 'spaceship/lib/spaceship/portal/app.rb', line 31

def bundle_id
  @bundle_id
end

#cloud_containers_countFixnum

Returns Number of associated cloud containers.

Returns:

  • (Fixnum)

    Number of associated cloud containers



52
53
54
# File 'spaceship/lib/spaceship/portal/app.rb', line 52

def cloud_containers_count
  @cloud_containers_count
end

#dev_push_enabledBool

Returns Development Push Enabled?.

Returns:

  • (Bool)

    Development Push Enabled?



43
44
45
# File 'spaceship/lib/spaceship/portal/app.rb', line 43

def dev_push_enabled
  @dev_push_enabled
end

#enable_servicesArray

Returns List of enabled services.

Returns:

  • (Array)

    List of enabled services



40
41
42
# File 'spaceship/lib/spaceship/portal/app.rb', line 40

def enable_services
  @enable_services
end

#featuresHash

Returns Feature details.

Returns:

  • (Hash)

    Feature details



37
38
39
# File 'spaceship/lib/spaceship/portal/app.rb', line 37

def features
  @features
end

#identifiers_countFixnum

Returns Number of associated identifiers.

Returns:

  • (Fixnum)

    Number of associated identifiers



55
56
57
# File 'spaceship/lib/spaceship/portal/app.rb', line 55

def identifiers_count
  @identifiers_count
end

#is_wildcardBool

Returns Is this app a wildcard app (e.g. com.krausefx.*).

Returns:

  • (Bool)

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



34
35
36
# File 'spaceship/lib/spaceship/portal/app.rb', line 34

def is_wildcard
  @is_wildcard
end

#nameString

Returns The name you provided for this app.

Examples:

"Spaceship"

Returns:

  • (String)

    The name you provided for this app



16
17
18
# File 'spaceship/lib/spaceship/portal/app.rb', line 16

def name
  @name
end

#platformString

Returns the supported platform of this app.

Examples:

"ios"

Returns:

  • (String)

    the supported platform of this app



21
22
23
# File 'spaceship/lib/spaceship/portal/app.rb', line 21

def platform
  @platform
end

#prefixObject

Prefix provided by the Dev Portal

Examples:

"5A997XSHK2"


26
27
28
# File 'spaceship/lib/spaceship/portal/app.rb', line 26

def prefix
  @prefix
end

#prod_push_enabledBool

Returns Production Push Enabled?.

Returns:

  • (Bool)

    Production Push Enabled?



46
47
48
# File 'spaceship/lib/spaceship/portal/app.rb', line 46

def prod_push_enabled
  @prod_push_enabled
end

Class Method Details

.all(mac: false) ⇒ Array

Returns all apps available for this account

Parameters:

  • mac (Bool) (defaults to: false)

    Fetches Mac apps if true

Returns:

  • (Array)

    Returns all apps available for this account



79
80
81
# File 'spaceship/lib/spaceship/portal/app.rb', line 79

def all(mac: false)
  client.apps(mac: mac).map { |app| self.new(app) }
end

.create!(bundle_id: nil, name: nil, mac: false, enable_services: {}) ⇒ App

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

Parameters:

  • bundle_id (String) (defaults to: nil)

    the bundle id (app_identifier) of the app associated with this provisioning profile

  • name (String) (defaults to: nil)

    the name of the App

  • mac (Bool) (defaults to: false)

    is this a Mac app?

Returns:

  • (App)

    The app you just created



90
91
92
93
94
95
96
97
98
99
# File 'spaceship/lib/spaceship/portal/app.rb', line 90

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) ⇒ App

Find a specific App ID based on the bundle_id

Parameters:

  • mac (Bool) (defaults to: false)

    Searches Mac apps if true

Returns:

  • (App)

    The app you’re looking for. This is nil if the app can’t be found.



104
105
106
107
108
109
# File 'spaceship/lib/spaceship/portal/app.rb', line 104

def find(bundle_id, mac: false)
  raise "`bundle_id` parameter must not be nil" if bundle_id.nil?
  all(mac: mac).find do |app|
    return app if app.bundle_id.casecmp(bundle_id) == 0
  end
end

Instance Method Details

#associate_groups(groups) ⇒ App

Associate specific groups with this app

Returns:

  • (App)

    The updated detailed app. This is nil if the app couldn’t be found



144
145
146
147
148
# File 'spaceship/lib/spaceship/portal/app.rb', line 144

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) ⇒ App

Associate specific merchants with this app

Returns:

  • (App)

    The updated detailed app. This is nil if the app couldn’t be found



152
153
154
155
# File 'spaceship/lib/spaceship/portal/app.rb', line 152

def associate_merchants(merchants)
  app = client.associate_merchants_with_app(self, merchants, mac?)
  self.class.factory(app)
end

#delete!App

Delete this App ID. This action will most likely fail if the App ID is already in the store or there are active profiles

Returns:

  • (App)

    The app you just deletd



123
124
125
126
# File 'spaceship/lib/spaceship/portal/app.rb', line 123

def delete!
  client.delete_app!(app_id, mac: mac?)
  self
end

#detailsApp

Fetch a specific App ID details based on the bundle_id

Returns:

  • (App)

    The app you’re looking for. This is nil if the app can’t be found.



137
138
139
140
# File 'spaceship/lib/spaceship/portal/app.rb', line 137

def details
  app = client.details_for_app(self)
  self.class.factory(app)
end

#mac?Bool

Returns Is this a Mac app?.

Returns:

  • (Bool)

    Is this a Mac app?



166
167
168
# File 'spaceship/lib/spaceship/portal/app.rb', line 166

def mac?
  platform == 'mac'
end

#update_name!(name, mac: false) ⇒ App

Update name of this App ID.

Returns:

  • (App)

    The app you updated. This is nil if the app can’t be found



130
131
132
133
# File 'spaceship/lib/spaceship/portal/app.rb', line 130

def update_name!(name, mac: false)
  app = client.update_app_name!(app_id, name, mac: mac)
  self.class.factory(app)
end

#update_service(service) ⇒ App

Update a service for the app with given AppService object

Returns:

  • (App)

    The updated detailed app. This is nil if the app couldn’t be found



159
160
161
162
163
# File 'spaceship/lib/spaceship/portal/app.rb', line 159

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