Class: Spaceship::TestFlight::Build
- Defined in:
- spaceship/lib/spaceship/test_flight/build.rb
Constant Summary collapse
- BUILD_STATES =
{ processing: 'testflight.build.state.processing', active: 'testflight.build.state.testing.active', ready_to_submit: 'testflight.build.state.submit.ready', ready_to_test: 'testflight.build.state.testing.ready', export_compliance_missing: 'testflight.build.state.export.compliance.missing', review_rejected: 'testflight.build.state.review.rejected', approved: 'testflight.build.state.review.approved' }
Instance Attribute Summary collapse
-
#auto_notify_enabled ⇒ Object
Returns the value of attribute auto_notify_enabled.
-
#beta_review_info ⇒ Spaceship::TestFlight::BetaReviewInfo
Getting builds from BuildTrains only gets a partial Build object We are then requesting the full build from iTC when we need to access any of the variables below, because they are not included in the partial Build objects.
-
#build_sdk ⇒ Object
Returns the value of attribute build_sdk.
- #build_version ⇒ Object
- #bundle_id ⇒ Object
-
#contains_odr ⇒ Object
Returns the value of attribute contains_odr.
-
#crash_count ⇒ Object
Returns the value of attribute crash_count.
-
#did_notify ⇒ Object
Returns the value of attribute did_notify.
-
#dsym_url ⇒ Object
Returns the value of attribute dsym_url.
- #export_compliance ⇒ Spaceship::TestFlight::ExportCompliance
- #external_state ⇒ Object
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#id ⇒ Object
Internal build ID (int).
-
#include_symbols ⇒ Object
Returns the value of attribute include_symbols.
-
#install_count ⇒ Object
Returns the value of attribute install_count.
- #internal_state ⇒ Object
-
#invite_count ⇒ Object
Returns the value of attribute invite_count.
-
#number_of_asset_packs ⇒ Object
Returns the value of attribute number_of_asset_packs.
- #test_info ⇒ Spaceship::TestFlight::TestInfo
- #train_version ⇒ Object
-
#upload_date ⇒ Time
An parsed Time value for the upload_date.
Attributes inherited from Base
Class Method Summary collapse
- .all(app_id: nil, platform: nil, retry_count: 0) ⇒ Object
-
.all_processing_builds(app_id: nil, platform: nil, retry_count: 0) ⇒ Object
Just the builds, as a flat array, that are still processing.
-
.all_waiting_for_review(app_id: nil, platform: nil, retry_count: 0) ⇒ Object
Just the builds, as a flat array, that are waiting for beta review.
- .builds_for_train(app_id: nil, platform: nil, train_version: nil, retry_count: 3) ⇒ Object
-
.find(app_id: nil, build_id: nil) ⇒ Spaceship::TestFlight::Build
Find a Build by ‘build_id`.
- .latest(app_id: nil, platform: nil) ⇒ Object
Instance Method Summary collapse
- #active? ⇒ Boolean
- #add_group!(group) ⇒ Object
- #approved? ⇒ Boolean
- #expire! ⇒ Object
- #export_compliance_missing? ⇒ Boolean
- #processed? ⇒ Boolean
- #processing? ⇒ Boolean
- #ready_to_submit? ⇒ Boolean
- #ready_to_test? ⇒ Boolean
-
#reload ⇒ Spaceship::Base::DataHash
reload the raw_data resource for this build.
- #review_rejected? ⇒ Boolean
-
#save! ⇒ Object
saves the changes to the Build object to TestFlight.
- #submit_for_testflight_review! ⇒ Object
- #update_build_information!(description: nil, feedback_email: nil, whats_new: nil) ⇒ Object
Methods inherited from Base
Methods inherited from Base
attr_accessor, attr_mapping, attributes, #attributes, factory, #initialize, #inspect, mapping_module, method_missing, set_client, #setup, #to_s
Constructor Details
This class inherits a constructor from Spaceship::Base
Instance Attribute Details
#auto_notify_enabled ⇒ Object
Returns the value of attribute auto_notify_enabled.
51 52 53 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 51 def auto_notify_enabled @auto_notify_enabled end |
#beta_review_info ⇒ Spaceship::TestFlight::BetaReviewInfo
Getting builds from BuildTrains only gets a partial Build object We are then requesting the full build from iTC when we need to access any of the variables below, because they are not included in the partial Build objects
‘super` here calls `beta_review_info` as defined by the `attr_mapping` above.
180 181 182 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 180 def beta_review_info @beta_review_info end |
#build_sdk ⇒ Object
Returns the value of attribute build_sdk.
57 58 59 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 57 def build_sdk @build_sdk end |
#build_version ⇒ Object
39 40 41 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 39 def build_version @build_version end |
#bundle_id ⇒ Object
14 15 16 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 14 def bundle_id @bundle_id end |
#contains_odr ⇒ Object
Returns the value of attribute contains_odr.
60 61 62 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 60 def contains_odr @contains_odr end |
#crash_count ⇒ Object
Returns the value of attribute crash_count.
49 50 51 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 49 def crash_count @crash_count end |
#did_notify ⇒ Object
Returns the value of attribute did_notify.
52 53 54 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 52 def did_notify @did_notify end |
#dsym_url ⇒ Object
Returns the value of attribute dsym_url.
56 57 58 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 56 def dsym_url @dsym_url end |
#export_compliance ⇒ Spaceship::TestFlight::ExportCompliance
186 187 188 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 186 def export_compliance @export_compliance end |
#external_state ⇒ Object
26 27 28 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 26 def external_state @external_state end |
#file_name ⇒ Object
Returns the value of attribute file_name.
61 62 63 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 61 def file_name @file_name end |
#id ⇒ Object
Internal build ID (int)
31 32 33 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 31 def id @id end |
#include_symbols ⇒ Object
Returns the value of attribute include_symbols.
58 59 60 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 58 def include_symbols @include_symbols end |
#install_count ⇒ Object
Returns the value of attribute install_count.
47 48 49 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 47 def install_count @install_count end |
#internal_state ⇒ Object
20 21 22 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 20 def internal_state @internal_state end |
#invite_count ⇒ Object
Returns the value of attribute invite_count.
48 49 50 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 48 def invite_count @invite_count end |
#number_of_asset_packs ⇒ Object
Returns the value of attribute number_of_asset_packs.
59 60 61 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 59 def number_of_asset_packs @number_of_asset_packs end |
#test_info ⇒ Spaceship::TestFlight::TestInfo
192 193 194 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 192 def test_info @test_info end |
#train_version ⇒ Object
35 36 37 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 35 def train_version @train_version end |
#upload_date ⇒ Time
Returns an parsed Time value for the upload_date.
198 199 200 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 198 def upload_date @upload_date end |
Class Method Details
.all(app_id: nil, platform: nil, retry_count: 0) ⇒ Object
107 108 109 110 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 107 def self.all(app_id: nil, platform: nil, retry_count: 0) trains = BuildTrains.all(app_id: app_id, platform: platform, retry_count: retry_count) trains.values.flatten end |
.all_processing_builds(app_id: nil, platform: nil, retry_count: 0) ⇒ Object
Just the builds, as a flat array, that are still processing
118 119 120 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 118 def self.all_processing_builds(app_id: nil, platform: nil, retry_count: 0) all(app_id: app_id, platform: platform, retry_count: retry_count).find_all(&:processing?) end |
.all_waiting_for_review(app_id: nil, platform: nil, retry_count: 0) ⇒ Object
Just the builds, as a flat array, that are waiting for beta review
123 124 125 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 123 def self.all_waiting_for_review(app_id: nil, platform: nil, retry_count: 0) all(app_id: app_id, platform: platform, retry_count: retry_count).select { |app| app.external_state == 'testflight.build.state.review.waiting' } end |
.builds_for_train(app_id: nil, platform: nil, train_version: nil, retry_count: 3) ⇒ Object
112 113 114 115 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 112 def self.builds_for_train(app_id: nil, platform: nil, train_version: nil, retry_count: 3) builds_data = client.get_builds_for_train(app_id: app_id, platform: platform, train_version: train_version, retry_count: retry_count) builds_data.map { |data| self.new(data) } end |
.find(app_id: nil, build_id: nil) ⇒ Spaceship::TestFlight::Build
Find a Build by ‘build_id`.
102 103 104 105 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 102 def self.find(app_id: nil, build_id: nil) attrs = client.get_build(app_id: app_id, build_id: build_id) self.new(attrs) end |
.latest(app_id: nil, platform: nil) ⇒ Object
127 128 129 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 127 def self.latest(app_id: nil, platform: nil) all(app_id: app_id, platform: platform).sort_by(&:upload_date).last end |
Instance Method Details
#active? ⇒ Boolean
150 151 152 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 150 def active? external_state == BUILD_STATES[:active] end |
#add_group!(group) ⇒ Object
224 225 226 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 224 def add_group!(group) client.add_group_to_build(app_id: app_id, group_id: group.id, build_id: id) end |
#approved? ⇒ Boolean
166 167 168 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 166 def approved? external_state == BUILD_STATES[:approved] end |
#expire! ⇒ Object
220 221 222 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 220 def expire! client.expire_build(app_id: app_id, build_id: id, build: self) end |
#export_compliance_missing? ⇒ Boolean
158 159 160 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 158 def export_compliance_missing? external_state == BUILD_STATES[:export_compliance_missing] end |
#processed? ⇒ Boolean
170 171 172 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 170 def processed? active? || ready_to_submit? || export_compliance_missing? || review_rejected? end |
#processing? ⇒ Boolean
154 155 156 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 154 def processing? external_state == BUILD_STATES[:processing] end |
#ready_to_submit? ⇒ Boolean
142 143 144 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 142 def ready_to_submit? external_state == BUILD_STATES[:ready_to_submit] end |
#ready_to_test? ⇒ Boolean
146 147 148 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 146 def ready_to_test? external_state == BUILD_STATES[:ready_to_test] end |
#reload ⇒ Spaceship::Base::DataHash
reload the raw_data resource for this build. This is useful when we start with a partial build response as returned by the BuildTrains, but then need to look up some attributes on the full build representation.
Note: this will overwrite any non-saved changes to the object
138 139 140 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 138 def reload self.raw_data = self.class.find(app_id: app_id, build_id: id).raw_data end |
#review_rejected? ⇒ Boolean
162 163 164 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 162 def review_rejected? external_state == BUILD_STATES[:review_rejected] end |
#save! ⇒ Object
saves the changes to the Build object to TestFlight
203 204 205 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 203 def save! client.put_build(app_id: app_id, build_id: id, build: self) end |
#submit_for_testflight_review! ⇒ Object
214 215 216 217 218 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 214 def submit_for_testflight_review! return if ready_to_test? return if approved? client.post_for_testflight_review(app_id: app_id, build_id: id, build: self) end |
#update_build_information!(description: nil, feedback_email: nil, whats_new: nil) ⇒ Object
207 208 209 210 211 212 |
# File 'spaceship/lib/spaceship/test_flight/build.rb', line 207 def update_build_information!(description: nil, feedback_email: nil, whats_new: nil) test_info.description = description if description test_info.feedback_email = feedback_email if feedback_email test_info.whats_new = whats_new if whats_new save! end |