Class: Spaceship::Portal::WebsitePush

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

Overview

Represents an Website Push 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 (website identifier) of website push id.

Examples:

"web.com.krausefx.app"

Returns:

  • (String)

    The bundle_id (website identifier) of website push id



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

def bundle_id
  @bundle_id
end

#nameString

Returns The name you provided for this website push.

Examples:

"Spaceship"

Returns:

  • (String)

    The name you provided for this website push



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

def name
  @name
end

#platformString

Returns the supported platform of this website push.

Examples:

"ios"

Returns:

  • (String)

    the supported platform of this website push



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

def platform
  @platform
end

#prefixObject

Prefix provided by the Dev Portal

Examples:

"5A997XSHK2"


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

def prefix
  @prefix
end

#statusString

Returns Status of the website push.

Examples:

"current"

Returns:

  • (String)

    Status of the website push



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

def status
  @status
end

#website_idString Also known as: app_id

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

Examples:

"RGAWZGXSAA"

Returns:

  • (String)

    The identifier of this website push, provided by the Dev Portal



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

def website_id
  @website_id
end

Class Method Details

.all(mac: false) ⇒ Array

Returns all website push available for this account

Parameters:

  • mac (Bool) (defaults to: false)

    Fetches Mac website push if true

Returns:

  • (Array)

    Returns all website push available for this account



50
51
52
# File 'spaceship/lib/spaceship/portal/website_push.rb', line 50

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

.create!(bundle_id: nil, name: nil, mac: false) ⇒ Website Push

Creates a new Website Push ID on the Apple Dev Portal

Parameters:

  • bundle_id (String) (defaults to: nil)

    the bundle id (website_push_identifier) of the website push

  • name (String) (defaults to: nil)

    the name of the Website Push

  • mac (Bool) (defaults to: false)

    is this a Mac Website Push?

Returns:

  • (Website Push)

    The Website Push you just created



60
61
62
63
# File 'spaceship/lib/spaceship/portal/website_push.rb', line 60

def create!(bundle_id: nil, name: nil, mac: false)
  new_website_push = client.create_website_push!(name, bundle_id, mac: mac)
  self.new(new_website_push)
end

.find(bundle_id, mac: false) ⇒ Website Push

Find a specific Website Push ID based on the bundle_id

Parameters:

  • mac (Bool) (defaults to: false)

    Searches Mac website pushes if true

Returns:

  • (Website Push)

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



68
69
70
71
72
# File 'spaceship/lib/spaceship/portal/website_push.rb', line 68

def find(bundle_id, mac: false)
  all(mac: mac).find do |website_push|
    website_push.bundle_id == bundle_id
  end
end

Instance Method Details

#delete!Website Push

Delete this Website Push ID.

Returns:

  • (Website Push)

    The website you just deleted



77
78
79
80
# File 'spaceship/lib/spaceship/portal/website_push.rb', line 77

def delete!
  client.delete_website_push!(website_id, mac: mac?)
  self
end

#mac?Bool

Returns Is this a Mac website push?.

Returns:

  • (Bool)

    Is this a Mac website push?



83
84
85
# File 'spaceship/lib/spaceship/portal/website_push.rb', line 83

def mac?
  platform == 'mac'
end