spaceship/lib/spaceship/connect_api/users/client.rb in fastlane-2.156.1 vs spaceship/lib/spaceship/connect_api/users/client.rb in fastlane-2.157.0
- old
+ new
@@ -1,28 +1,19 @@
-require_relative '../client'
+require_relative '../api_client'
+require_relative './users'
require_relative '../../tunes/tunes_client'
module Spaceship
class ConnectAPI
module Users
- class Client < Spaceship::ConnectAPI::Client
- def self.instance
- # Verify there is a token or a client that can be used
- if Spaceship::ConnectAPI.token
- if @client.nil? || @client.token != Spaceship::ConnectAPI.token
- @client = Client.new(token: Spaceship::ConnectAPI.token)
- end
- elsif Spaceship::Tunes.client
- # Initialize new client if new or if team changed
- if @client.nil? || @client.team_id != Spaceship::Tunes.client.team_id
- @client = Client.client_with_authorization_from(Spaceship::Tunes.client)
- end
- end
+ class Client < Spaceship::ConnectAPI::APIClient
+ def initialize(cookie: nil, current_team_id: nil, token: nil, another_client: nil)
+ another_client ||= Spaceship::Tunes.client if cookie.nil? && token.nil?
- # Need to handle not having a client but this shouldn't ever happen
- raise "Please login using `Spaceship::Tunes.login('user', 'password')`" unless @client
+ super(cookie: cookie, current_team_id: current_team_id, token: token, another_client: another_client)
- @client
+ self.extend(Spaceship::ConnectAPI::Users::API)
+ self.users_request_client = self
end
def self.hostname
'https://appstoreconnect.apple.com/iris/v1/'
end