Sha256: f90ee0135f8f18dd092eca921014b5095a10673e9dd95b73cbb875b981e419a4

Contents?: true

Size: 1.08 KB

Versions: 24

Compression:

Stored size: 1.08 KB

Contents

require_relative '../client'
require_relative '../../tunes/tunes_client'

module Spaceship
  class ConnectAPI
    module Tunes
      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

          # Need to handle not having a client but this shouldn't ever happen
          raise "Please login using `Spaceship::Tunes.login('user', 'password')`" unless @client

          @client
        end

        def self.hostname
          'https://appstoreconnect.apple.com/iris/v1/'
        end
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
fastlane-2.156.1 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.156.0 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.155.3 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.155.2 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.155.1 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.155.0 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.154.0 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.153.1 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.153.0 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.152.0 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.151.2 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.151.1 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.151.0 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.150.3 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.150.2 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.150.1 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.150.0 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.150.0.rc7 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.150.0.rc6 spaceship/lib/spaceship/connect_api/tunes/client.rb
fastlane-2.150.0.rc5 spaceship/lib/spaceship/connect_api/tunes/client.rb