class Spaceship::Portal::Merchant

Represents a Merchant ID from the Developer Portal

Attributes

bundle_id[RW]

@return (String) The bundle_id (merchant identifier) of merchant id @example

"merchant.com.krausefx.app.production"
merchant_id[RW]

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

"LM1UX73BAC"
name[RW]

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

"Spaceship Production"
platform[RW]

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

"ios"
prefix[RW]

Prefix provided by the Dev Portal @example

"5A9972XTK2"
status[RW]

@return (String) Status of the merchant @example

"current"

Public Class Methods

all(mac: false) click to toggle source

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

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

Creates a new Merchant on the Apple Dev Portal

@param bundle_id [String] the bundle id (merchant_identifier) of the merchant @param name [String] the name of the Merchant @param mac [Bool] is this a Mac Merchant? @return (Merchant) The Merchant you just created

# File spaceship/lib/spaceship/portal/merchant.rb, line 58
def create!(bundle_id: nil, name: nil, mac: false)
  new_merchant = client.create_merchant!(name, bundle_id, mac: mac)
  new(new_merchant)
end
find(bundle_id, mac: false) click to toggle source

Find a specific Merchant ID based on the bundle_id @param mac [Bool] Searches Mac merchants if true @return (Merchant) The Merchant you're looking for. This is nil if the merchant can't be found.

# File spaceship/lib/spaceship/portal/merchant.rb, line 66
def find(bundle_id, mac: false)
  all(mac: mac).find do |merchant|
    merchant.bundle_id == bundle_id
  end
end

Public Instance Methods

delete!() click to toggle source

Delete this Merchant @return (Merchant) The merchant you just deleted

# File spaceship/lib/spaceship/portal/merchant.rb, line 75
def delete!
  client.delete_merchant!(merchant_id, mac: mac?)
  self
end
mac?() click to toggle source

@return (Bool) Is this a Mac merchant?

# File spaceship/lib/spaceship/portal/merchant.rb, line 81
def mac?
  platform == 'mac'
end