lib/spaceship/client.rb in spaceship-0.0.11 vs lib/spaceship/client.rb in spaceship-0.0.13

- old
+ new

@@ -28,19 +28,19 @@ class UnexpectedResponse < StandardError; end # Authenticates with Apple's web services. This method has to be called once # to generate a valid session. The session will automatically be used from then # on. - # + # # 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 - # + # # @raise InvalidUserCredentialsError: raised if authentication failed - # + # # @return (Spaceship::Client) The client the login method was called for def self.login(user = nil, password = nil) instance = self.new if instance.login(user, password) instance @@ -136,19 +136,19 @@ ##################################################### # Authenticates with Apple's web services. This method has to be called once # to generate a valid session. The session will automatically be used from then # on. - # + # # 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 - # + # # @raise InvalidUserCredentialsError: raised if authentication failed - # + # # @return (Spaceship::Client) The client the login method was called for def login(user = nil, password = nil) if user.to_s.empty? or password.to_s.empty? require 'credentials_manager' data = CredentialsManager::PasswordManager.shared_manager(user, false) @@ -173,11 +173,11 @@ # User Credentials are wrong raise InvalidUserCredentialsError.new(response) end end - # @return (Bool) Do we have a valid session? + # @return (Bool) Do we have a valid session? def session? !!@cookie end # @return (Array) A list of all available teams @@ -234,10 +234,18 @@ }) parse_response(r, 'appIds') end end + def details_for_app(app) + r = request(:post, 'account/ios/identifiers/getAppIdDetail.action', { + teamId: team_id, + appIdId: app.app_id + }) + parse_response(r, 'appId') + end + def create_app!(type, name, bundle_id) ident_params = case type.to_sym when :explicit { type: 'explicit', @@ -417,11 +425,11 @@ if tokens and not tokens.empty? @csrf_tokens = tokens end end end - + # memoize the last csrf tokens from responses def csrf_tokens @csrf_tokens || {} end @@ -466,10 +474,10 @@ def send_request(method, url_or_path, params, headers, &block) tries ||= 5 return @client.send(method, url_or_path, params, headers, &block) - rescue Faraday::Error::TimeoutError => ex # New Farday version: Faraday::TimeoutError => ex + rescue Faraday::Error::TimeoutError => ex # New Faraday version: Faraday::TimeoutError => ex unless (tries -= 1).zero? sleep 3 retry end