Class: Spaceship::ConnectAPI::Build
- Inherits:
-
Object
- Object
- Spaceship::ConnectAPI::Build
- Includes:
- Model
- Defined in:
- spaceship/lib/spaceship/connect_api/models/build.rb
Defined Under Namespace
Modules: ProcessingState
Constant Summary collapse
- ESSENTIAL_INCLUDES =
"app,buildBetaDetail,preReleaseVersion"
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
-
#beta_app_review_submission ⇒ Object
Returns the value of attribute beta_app_review_submission.
-
#beta_build_localizations ⇒ Object
Returns the value of attribute beta_build_localizations.
-
#beta_build_metrics ⇒ Object
Returns the value of attribute beta_build_metrics.
-
#build_beta_detail ⇒ Object
Returns the value of attribute build_beta_detail.
-
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
-
#expired ⇒ Object
Returns the value of attribute expired.
-
#icon_asset_token ⇒ Object
Returns the value of attribute icon_asset_token.
-
#min_os_version ⇒ Object
Returns the value of attribute min_os_version.
-
#pre_release_version ⇒ Object
Returns the value of attribute pre_release_version.
-
#processing_state ⇒ Object
Returns the value of attribute processing_state.
-
#uploaded_date ⇒ Object
Returns the value of attribute uploaded_date.
-
#uses_non_exempt_encryption ⇒ Object
Returns the value of attribute uses_non_exempt_encryption.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes included from Model
Class Method Summary collapse
-
.all(client: nil, app_id: nil, version: nil, build_number: nil, platform: nil, processing_states: "PROCESSING,FAILED,INVALID,VALID", includes: ESSENTIAL_INCLUDES, sort: "-uploadedDate", limit: 30) ⇒ Object
API.
- .get(client: nil, build_id: nil, includes: ESSENTIAL_INCLUDES) ⇒ Object
- .type ⇒ Object
Instance Method Summary collapse
- #add_beta_groups(client: nil, beta_groups: nil) ⇒ Object
- #app_id ⇒ Object
-
#app_version ⇒ Object
Helpers.
- #bundle_id ⇒ Object
- #expire!(client: nil) ⇒ Object
- #get_beta_build_localizations(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
- #get_build_beta_details(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
- #missing_export_compliance? ⇒ Boolean
- #platform ⇒ Object
- #post_beta_app_review_submission(client: nil) ⇒ Object
- #processed? ⇒ Boolean
- #ready_for_beta_submission? ⇒ Boolean
- #ready_for_internal_testing? ⇒ Boolean
-
#to_testflight_build ⇒ Object
This is here temporarily until the removal of Spaceship::TestFlight.
- #update(client: nil, attributes: nil) ⇒ Object
Methods included from Model
#attr_mapping, included, #initialize, #reverse_attr_mapping, #to_json, #update_attributes
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
17 18 19 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 17 def app @app end |
#beta_app_review_submission ⇒ Object
Returns the value of attribute beta_app_review_submission.
18 19 20 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 18 def beta_app_review_submission @beta_app_review_submission end |
#beta_build_localizations ⇒ Object
Returns the value of attribute beta_build_localizations.
20 21 22 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 20 def beta_build_localizations @beta_build_localizations end |
#beta_build_metrics ⇒ Object
Returns the value of attribute beta_build_metrics.
19 20 21 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 19 def beta_build_metrics @beta_build_metrics end |
#build_beta_detail ⇒ Object
Returns the value of attribute build_beta_detail.
21 22 23 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 21 def build_beta_detail @build_beta_detail end |
#expiration_date ⇒ Object
Returns the value of attribute expiration_date.
10 11 12 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 10 def expiration_date @expiration_date end |
#expired ⇒ Object
Returns the value of attribute expired.
11 12 13 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 11 def expired @expired end |
#icon_asset_token ⇒ Object
Returns the value of attribute icon_asset_token.
13 14 15 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 13 def icon_asset_token @icon_asset_token end |
#min_os_version ⇒ Object
Returns the value of attribute min_os_version.
12 13 14 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 12 def min_os_version @min_os_version end |
#pre_release_version ⇒ Object
Returns the value of attribute pre_release_version.
22 23 24 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 22 def pre_release_version @pre_release_version end |
#processing_state ⇒ Object
Returns the value of attribute processing_state.
14 15 16 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 14 def processing_state @processing_state end |
#uploaded_date ⇒ Object
Returns the value of attribute uploaded_date.
9 10 11 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 9 def uploaded_date @uploaded_date end |
#uses_non_exempt_encryption ⇒ Object
Returns the value of attribute uses_non_exempt_encryption.
15 16 17 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 15 def uses_non_exempt_encryption @uses_non_exempt_encryption end |
#version ⇒ Object
Returns the value of attribute version.
8 9 10 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 8 def version @version end |
Class Method Details
.all(client: nil, app_id: nil, version: nil, build_number: nil, platform: nil, processing_states: "PROCESSING,FAILED,INVALID,VALID", includes: ESSENTIAL_INCLUDES, sort: "-uploadedDate", limit: 30) ⇒ Object
API
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 116 def self.all(client: nil, app_id: nil, version: nil, build_number: nil, platform: nil, processing_states: "PROCESSING,FAILED,INVALID,VALID", includes: ESSENTIAL_INCLUDES, sort: "-uploadedDate", limit: 30) client ||= Spaceship::ConnectAPI resps = client.get_builds( filter: { app: app_id, "preReleaseVersion.version" => version, version: build_number, processingState: processing_states }, includes: includes, sort: sort, limit: limit ).all_pages models = resps.flat_map(&:to_models) # Filtering after models are fetched since there is no way to do this in a query param filter if platform models = models.select do |build| build.pre_release_version && build.pre_release_version.platform == platform end end return models end |
.get(client: nil, build_id: nil, includes: ESSENTIAL_INCLUDES) ⇒ Object
136 137 138 139 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 136 def self.get(client: nil, build_id: nil, includes: ESSENTIAL_INCLUDES) client ||= Spaceship::ConnectAPI return client.get_build(build_id: build_id, includes: includes).first end |
.type ⇒ Object
51 52 53 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 51 def self.type return "builds" end |
Instance Method Details
#add_beta_groups(client: nil, beta_groups: nil) ⇒ Object
147 148 149 150 151 152 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 147 def add_beta_groups(client: nil, beta_groups: nil) client ||= Spaceship::ConnectAPI beta_groups ||= [] beta_group_ids = beta_groups.map(&:id) return client.add_beta_groups_to_build(build_id: id, beta_group_ids: beta_group_ids) end |
#app_id ⇒ Object
64 65 66 67 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 64 def app_id raise "No app included" unless app return app.id end |
#app_version ⇒ Object
Helpers
59 60 61 62 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 59 def app_version raise "No pre_release_version included" unless pre_release_version return pre_release_version.version end |
#bundle_id ⇒ Object
69 70 71 72 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 69 def bundle_id raise "No app included" unless app return app.bundle_id end |
#expire!(client: nil) ⇒ Object
181 182 183 184 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 181 def expire!(client: nil) client ||= Spaceship::ConnectAPI return client.patch_builds(build_id: id, attributes: { expired: true }) end |
#get_beta_build_localizations(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
154 155 156 157 158 159 160 161 162 163 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 154 def get_beta_build_localizations(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) client ||= Spaceship::ConnectAPI resps = client.get_beta_build_localizations( filter: { build: id }, includes: includes, sort: sort, limit: limit ).all_pages return resps.flat_map(&:to_models) end |
#get_build_beta_details(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
165 166 167 168 169 170 171 172 173 174 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 165 def get_build_beta_details(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) client ||= Spaceship::ConnectAPI resps = client.get_build_beta_details( filter: { build: id }, includes: includes, sort: sort, limit: limit ).all_pages return resps.flat_map(&:to_models) end |
#missing_export_compliance? ⇒ Boolean
92 93 94 95 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 92 def missing_export_compliance? raise "No build_beta_detail included" unless build_beta_detail return build_beta_detail.missing_export_compliance? end |
#platform ⇒ Object
74 75 76 77 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 74 def platform raise "No pre_release_version included" unless pre_release_version return pre_release_version.platform end |
#post_beta_app_review_submission(client: nil) ⇒ Object
176 177 178 179 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 176 def post_beta_app_review_submission(client: nil) client ||= Spaceship::ConnectAPI return client.post_beta_app_review_submissions(build_id: id) end |
#processed? ⇒ Boolean
79 80 81 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 79 def processed? return processing_state != ProcessingState::PROCESSING end |
#ready_for_beta_submission? ⇒ Boolean
87 88 89 90 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 87 def ready_for_beta_submission? raise "No build_beta_detail included" unless build_beta_detail return build_beta_detail.ready_for_beta_submission? end |
#ready_for_internal_testing? ⇒ Boolean
83 84 85 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 83 def ready_for_internal_testing? return build_beta_detail.nil? == false && build_beta_detail.ready_for_internal_testing? end |
#to_testflight_build ⇒ Object
This is here temporarily until the removal of Spaceship::TestFlight
98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 98 def to_testflight_build h = { 'id' => id, 'buildVersion' => version, 'uploadDate' => uploaded_date, 'externalState' => processed? ? Spaceship::TestFlight::Build::BUILD_STATES[:active] : Spaceship::TestFlight::Build::BUILD_STATES[:processing], 'appAdamId' => app_id, 'bundleId' => bundle_id, 'trainVersion' => app_version } return Spaceship::TestFlight::Build.new(h) end |
#update(client: nil, attributes: nil) ⇒ Object
141 142 143 144 145 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 141 def update(client: nil, attributes: nil) client ||= Spaceship::ConnectAPI attributes = reverse_attr_mapping(attributes) return client.patch_builds(build_id: id, attributes: attributes).first end |