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_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(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(build_id: nil, includes: ESSENTIAL_INCLUDES) ⇒ Object
- .type ⇒ Object
Instance Method Summary collapse
- #add_beta_groups(beta_groups: nil) ⇒ Object
- #app_id ⇒ Object
-
#app_version ⇒ Object
Helpers.
- #bundle_id ⇒ Object
- #expire! ⇒ Object
- #get_beta_build_localizations(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
- #get_build_beta_details(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
- #platform ⇒ Object
- #post_beta_app_review_submission ⇒ 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.
Methods included from Model
#attr_mapping, included, #initialize, #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_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.
20 21 22 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 20 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.
21 22 23 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 21 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(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
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 109 def self.all(app_id: nil, version: nil, build_number: nil, platform: nil, processing_states: "PROCESSING,FAILED,INVALID,VALID", includes: ESSENTIAL_INCLUDES, sort: "-uploadedDate", limit: 30) resps = Spaceship::ConnectAPI.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(build_id: nil, includes: ESSENTIAL_INCLUDES) ⇒ Object
128 129 130 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 128 def self.get(build_id: nil, includes: ESSENTIAL_INCLUDES) return Spaceship::ConnectAPI.get_build(build_id: build_id, includes: includes).first end |
.type ⇒ Object
49 50 51 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 49 def self.type return "builds" end |
Instance Method Details
#add_beta_groups(beta_groups: nil) ⇒ Object
132 133 134 135 136 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 132 def add_beta_groups(beta_groups: nil) beta_groups ||= [] beta_group_ids = beta_groups.map(&:id) return Spaceship::ConnectAPI.add_beta_groups_to_build(build_id: id, beta_group_ids: beta_group_ids) end |
#app_id ⇒ Object
62 63 64 65 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 62 def app_id raise "No app included" unless app return app.id end |
#app_version ⇒ Object
Helpers
57 58 59 60 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 57 def app_version raise "No pre_release_version included" unless pre_release_version return pre_release_version.version end |
#bundle_id ⇒ Object
67 68 69 70 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 67 def bundle_id raise "No app included" unless app return app.bundle_id end |
#expire! ⇒ Object
162 163 164 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 162 def expire! return Spaceship::ConnectAPI.patch_builds(build_id: id, attributes: { expired: true }) end |
#get_beta_build_localizations(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
138 139 140 141 142 143 144 145 146 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 138 def get_beta_build_localizations(filter: {}, includes: nil, limit: nil, sort: nil) resps = Spaceship::ConnectAPI.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(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
148 149 150 151 152 153 154 155 156 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 148 def get_build_beta_details(filter: {}, includes: nil, limit: nil, sort: nil) resps = Spaceship::ConnectAPI.get_build_beta_details( filter: { build: id }, includes: includes, sort: sort, limit: limit ).all_pages return resps.flat_map(&:to_models) end |
#platform ⇒ Object
72 73 74 75 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 72 def platform raise "No pre_release_version included" unless pre_release_version return pre_release_version.platform end |
#post_beta_app_review_submission ⇒ Object
158 159 160 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 158 def post_beta_app_review_submission return Spaceship::ConnectAPI.post_beta_app_review_submissions(build_id: id) end |
#processed? ⇒ Boolean
77 78 79 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 77 def processed? return processing_state != ProcessingState::PROCESSING end |
#ready_for_beta_submission? ⇒ Boolean
85 86 87 88 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 85 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
81 82 83 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 81 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
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'spaceship/lib/spaceship/connect_api/models/build.rb', line 91 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 |