Class: Spaceship::Portal::AppGroup

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

Overview

Represents an app group of the Apple Dev 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, #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_group_idString

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

Examples:

"2MAY7NPHAA"


28
29
30
# File 'lib/spaceship/portal/app_group.rb', line 28

def app_group_id
  @app_group_id
end

#group_idString

Returns The identifier assigned to this group.

Examples:

"group.com.example.application"


8
9
10
# File 'lib/spaceship/portal/app_group.rb', line 8

def group_id
  @group_id
end

#nameString

Returns The name of this group.

Examples:

"App Group"


18
19
20
# File 'lib/spaceship/portal/app_group.rb', line 18

def name
  @name
end

#prefixString

Returns The prefix assigned to this group.

Examples:

"9J57U9392R"


13
14
15
# File 'lib/spaceship/portal/app_group.rb', line 13

def prefix
  @prefix
end

#statusString

Returns Status of the group.

Examples:

"current"


23
24
25
# File 'lib/spaceship/portal/app_group.rb', line 23

def status
  @status
end

Class Method Details

.allArray



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

def all
  client.app_groups.map { |group| self.factory(group) }
end

.create!(group_id: nil, name: nil) ⇒ AppGroup

Creates a new App Group on the Apple Dev Portal



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

def create!(group_id: nil, name: nil)
  new_group = client.create_app_group!(name, group_id)
  self.new(new_group)
end

.factory(attrs) ⇒ Object

Create a new object based on a hash. This is used to create a new object based on the server response.



41
42
43
# File 'lib/spaceship/portal/app_group.rb', line 41

def factory(attrs)
  self.new(attrs)
end

.find(group_id) ⇒ AppGroup

Find a specific App Group group_id



62
63
64
65
66
# File 'lib/spaceship/portal/app_group.rb', line 62

def find(group_id)
  all.find do |group|
    group.group_id == group_id
  end
end

Instance Method Details

#delete!AppGroup

Delete this app group



71
72
73
74
# File 'lib/spaceship/portal/app_group.rb', line 71

def delete!
  client.delete_app_group!(app_group_id)
  self
end