spaceship/lib/spaceship/connect_api/models/build.rb in fastlane-2.127.0.beta.20190709200015 vs spaceship/lib/spaceship/connect_api/models/build.rb in fastlane-2.127.0
- old
+ new
@@ -67,10 +67,15 @@
def bundle_id
raise "No app included" unless app
return app.bundle_id
end
+ def platform
+ raise "No pre_release_version included" unless pre_release_version
+ return pre_release_version.platform
+ end
+
def processed?
return processing_state != ProcessingState::PROCESSING
end
def ready_for_beta_submission?
@@ -79,10 +84,11 @@
end
# This is here temporarily until the removal of Spaceship::TestFlight
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,
@@ -94,17 +100,26 @@
#
# API
#
- def self.all(app_id: nil, version: nil, build_number: nil, includes: ESSENTIAL_INCLUDES, sort: "-uploadedDate", limit: 30)
+ def self.all(app_id: nil, version: nil, build_number: nil, platform: nil, includes: ESSENTIAL_INCLUDES, sort: "-uploadedDate", limit: 30)
resps = Spaceship::ConnectAPI.get_builds(
- filter: { app: app_id, "preReleaseVersion.version" => version, version: build_number },
+ filter: { app: app_id, "preReleaseVersion.version" => version, version: build_number, processingState: "PROCESSING,FAILED,INVALID,VALID" },
includes: includes,
sort: sort,
limit: limit
).all_pages
- return resps.map(&:to_models).flatten
+ models = resps.map(&:to_models).flatten
+
+ # 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
def self.get(build_id: nil, includes: ESSENTIAL_INCLUDES)
return Spaceship::ConnectAPI.get_build(build_id: build_id, includes: includes).first
end