Sha256: c941a2355a9d68b4d063e035f5db74b0642ed5c9456e0df655afd4fbf3cc9831

Contents?: true

Size: 1.14 KB

Versions: 582

Compression:

Stored size: 1.14 KB

Contents

require_relative '../base'
require_relative '../tunes/tunes_client'

module Spaceship
  module TestFlight
    class Base < Spaceship::Base
      def self.client
        # Verify there is a client that can be used
        if 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

      ##
      # Have subclasses inherit the client from their superclass
      #
      # Essentially, we are making a class-inheritable-accessor as described here:
      # https://apidock.com/rails/v4.2.7/Class/class_attribute
      def self.inherited(subclass)
        this_class = self
        subclass.define_singleton_method(:client) do
          this_class.client
        end
      end

      def to_json
        raw_data.to_json
      end
    end
  end
end

Version data entries

582 entries across 582 versions & 5 rubygems

Version Path
fastlane-2.225.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.224.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.223.1 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.223.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.222.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.221.1 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.221.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.220.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.219.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.218.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-security-patched-2.216.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.217.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.216.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.215.1 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.215.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-mercafacil-2.214.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.214.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.213.0 spaceship/lib/spaceship/test_flight/base.rb
fastlane-2.212.2 spaceship/lib/spaceship/test_flight/base.rb
fastlane_pricing_fix-2.212.1 spaceship/lib/spaceship/test_flight/base.rb