Class: Spaceship::TestFlight::BuildTrains

Inherits:
Base
  • Object
show all
Defined in:
spaceship/lib/spaceship/test_flight/build_trains.rb

Instance Attribute Summary

Attributes inherited from Base

#client, #raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

client, inherited, #to_json

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, factory, #inspect, mapping_module, method_missing, set_client, #setup, #to_s

Constructor Details

#initialize(trains = {}) ⇒ BuildTrains

Returns a new instance of BuildTrains.



33
34
35
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 33

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

Class Method Details

.all(app_id: nil, platform: nil, retry_count: 3) ⇒ Object

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`



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 15

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

Instance Method Details

#get(key) ⇒ Object Also known as: []



37
38
39
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 37

def get(key)
  @trains[key]
end

#valuesObject



42
43
44
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 42

def values
  @trains.values
end

#versionsObject



46
47
48
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 46

def versions
  @trains.keys
end