class Spaceship::ConnectAPI
Attributes
This client stores the global client when using the lazy syntax
Public Class Methods
Initializes client with Apple's App
Store Connect JWT auth key.
This method will automatically use the arguments from environment variables if not given.
The key_id, issuer_id and either filepath or key are needed to authenticate.
@param key_id (String
) (optional): The key id @param issuer_id (String
) (optional): The issuer id @param filepath (String
) (optional): The filepath @param key (String
) (optional): The key @param duration (Integer) (optional): How long this session should last @param in_house (Boolean) (optional): Whether this session is an Enterprise one
@raise InvalidUserCredentialsError: raised if authentication failed
@return (Spaceship::ConnectAPI::Client
) The client the login method was called for
# File spaceship/lib/spaceship/connect_api/spaceship.rb, line 62 def auth(key_id: nil, issuer_id: nil, filepath: nil, key: nil, duration: nil, in_house: nil) @client = ConnectAPI::Client.auth(key_id: key_id, issuer_id: issuer_id, filepath: filepath, key: key, duration: duration, in_house: in_house) end
Authenticates with Apple's web services. This method has to be called once to generate a valid session.
This method will automatically use the username from the Appfile (if available) and fetch the password from the Keychain (if available)
@param user (String
) (optional): The username (usually the email address) @param password (String
) (optional): The password @param use_portal (Boolean) (optional): Whether to log in to Spaceship::Portal
or not @param use_tunes (Boolean) (optional): Whether to log in to Spaceship::Tunes
or not @param portal_team_id (String
) (optional): The Spaceship::Portal
team id @param tunes_team_id (String
) (optional): The Spaceship::Tunes
team id @param team_name (String
) (optional): The team name @param skip_select_team (Boolean) (optional): Whether to skip automatic selection or prompt for team
@raise InvalidUserCredentialsError: raised if authentication failed
@return (Spaceship::ConnectAPI::Client
) The client the login method was called for
# File spaceship/lib/spaceship/connect_api/spaceship.rb, line 84 def login(user = nil, password = nil, use_portal: true, use_tunes: true, portal_team_id: nil, tunes_team_id: nil, team_name: nil, skip_select_team: false) @client = ConnectAPI::Client.login(user, password, use_portal: use_portal, use_tunes: use_tunes, portal_team_id: portal_team_id, tunes_team_id: tunes_team_id, team_name: team_name, skip_select_team: skip_select_team) end
Open up the team selection for the user (if necessary).
If the user is in multiple teams, a team selection is shown. The user can then select a team by entering the number
@param portal_team_id (String
) (optional): The Spaceship::Portal
team id @param tunes_team_id (String
) (optional): The Spaceship::Tunes
team id @param team_name (String
) (optional): The name of an App
Store Connect team
# File spaceship/lib/spaceship/connect_api/spaceship.rb, line 96 def select_team(portal_team_id: nil, tunes_team_id: nil, team_name: nil) return if client.nil? client.select_team(portal_team_id: portal_team_id, tunes_team_id: tunes_team_id, team_name: team_name) end
# File spaceship/lib/spaceship/connect_api/spaceship.rb, line 36 def token return nil if @client.nil? return @client.token end
# File spaceship/lib/spaceship/connect_api/spaceship.rb, line 32 def token=(token) @client = ConnectAPI::Client.new(token: token) end
# File spaceship/lib/spaceship/connect_api/spaceship.rb, line 41 def token? (@client && @client.token) end