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.



27
28
29
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 27

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
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 15

def self.all(app_id: nil, platform: nil, retry_count: 3)
  data = client.get_build_trains(app_id: app_id, platform: platform)
  trains = {}

  data.each do |train_version|
    builds_data = client.get_builds_for_train(app_id: app_id, platform: platform, train_version: train_version, retry_count: retry_count)
    trains[train_version] = builds_data.map { |attrs| Spaceship::TestFlight::Build.new(attrs) }
  end

  self.new(trains)
end

Instance Method Details

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



31
32
33
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 31

def get(key)
  @trains[key]
end

#valuesObject



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

def values
  @trains.values
end

#versionsObject



40
41
42
# File 'spaceship/lib/spaceship/test_flight/build_trains.rb', line 40

def versions
  @trains.keys
end