Class: Spaceship::Portal::Passbook

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

Overview

Represents an Passbook 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

#bundle_idString

Returns The bundle_id (passbook) of passbook id.

Examples:

"web.com.krausefx.app"

Returns:

  • (String)

    The bundle_id (passbook) of passbook id



30
31
32
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 30

def bundle_id
  @bundle_id
end

#nameString

Returns The name you provided for this passbook.

Examples:

"Spaceship"

Returns:

  • (String)

    The name you provided for this passbook



15
16
17
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 15

def name
  @name
end

#passbook_idString

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

Examples:

"RGAWZGXSAA"

Returns:

  • (String)

    The identifier of this passbook, provided by the Dev Portal



10
11
12
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 10

def passbook_id
  @passbook_id
end

#platformString

Returns the supported platform of this passbook.

Examples:

"ios"

Returns:

  • (String)

    the supported platform of this passbook



20
21
22
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 20

def platform
  @platform
end

#prefixObject

Prefix provided by the Dev Portal

Examples:

"5A997XSHK2"


25
26
27
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 25

def prefix
  @prefix
end

#statusString

Returns Status of the passbook.

Examples:

"current"

Returns:

  • (String)

    Status of the passbook



35
36
37
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 35

def status
  @status
end

Class Method Details

.allArray

Returns all passbook available for this account

Returns:

  • (Array)

    Returns all passbook available for this account



47
48
49
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 47

def all
  client.passbooks.map { |pass_type| self.new(pass_type) }
end

.create!(bundle_id: nil, name: nil) ⇒ Passbook

Creates a new Passbook ID on the Apple Dev Portal

Parameters:

  • bundle_id (String) (defaults to: nil)

    the bundle id (Passbook_id) of the passbook

  • name (String) (defaults to: nil)

    the name of the Passbook

Returns:

  • (Passbook)

    The Passbook you just created



56
57
58
59
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 56

def create!(bundle_id: nil, name: nil)
  new_passbook = client.create_passbook!(name, bundle_id)
  self.new(new_passbook)
end

.find(bundle_id) ⇒ Passbook

Find a specific Passbook ID based on the bundle_id

Returns:

  • (Passbook)

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



63
64
65
66
67
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 63

def find(bundle_id)
  all.find do |passbook|
    passbook.bundle_id == bundle_id
  end
end

Instance Method Details

#delete!Passbook

Delete this Passbook ID.

Returns:

  • (Passbook)

    The passbook you just deleted



72
73
74
75
# File 'spaceship/lib/spaceship/portal/passbook.rb', line 72

def delete!
  client.delete_passbook!(passbook_id)
  self
end