Sha256: 6e2f73c7e1104ba99f45c13406ce52599fad186494deeeb49070f946b3ca1e89

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

require_relative 'base'
require_relative 'build'

module Spaceship::TestFlight
  class BuildTrains < Base
    ##
    # BuildTrains represent the collection of builds for a `train_version`
    #
    # Note: builds returned by BuildTrains are _partially_ complete. Properties
    # such as `exportCompliance`, `testInfo` and many others are not provided.
    # It is the responsibility of Build to lazy-load the necessary properties.
    #
    # See `Spaceship::TestFlight::Build#reload`

    def self.all(app_id: nil, platform: nil, retry_count: 3)
      filter_platform = Spaceship::ConnectAPI::Platform.map(platform) if platform
      connect_builds = Spaceship::ConnectAPI::Build.all(
        app_id: app_id,
        sort: "uploadedDate",
        platform: filter_platform
      )

      trains = {}
      connect_builds.each do |connect_build|
        train_version = connect_build.app_version
        trains[train_version] ||= []
        trains[train_version] << connect_build.to_testflight_build
      end

      self.new(trains)
    end

    def initialize(trains = {})
      @trains = trains
    end

    def get(key)
      @trains[key]
    end
    alias [] get

    def values
      @trains.values
    end

    def versions
      @trains.keys
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fastlane_hotfix-2.165.1 spaceship/lib/spaceship/test_flight/build_trains.rb
fastlane_hotfix-2.165.0 spaceship/lib/spaceship/test_flight/build_trains.rb
fastlane_hotfix-2.187.0 spaceship/lib/spaceship/test_flight/build_trains.rb