Added access to build details of iTunes Connect #3641

Merged
merged 1 commit into from Mar 9, 2016

Projects

None yet

6 participants

@KrauseFx
Member
KrauseFx commented Mar 9, 2016

This PR adds a way to receive all builds and build trains even if the user doesn't use TestFlight.
Additionally you can now call build.details to get even more build details, in particular the dSYM download URL and information like the original file name, base SDK and more.

Added implementation and tests

@KrauseFx KrauseFx added the spaceship label Mar 9, 2016
@KrauseFx KrauseFx changed the title from [WIP] Added access to build details of iTunes Connect to Added access to build details of iTunes Connect Mar 9, 2016
@armcknight

👍 with the caveat that I do plan to transfer the delaunay app to a different account at some point in the next year, not sure if that will break the test or not.

@KrauseFx
Member
KrauseFx commented Mar 9, 2016

@armcknight don't worry, all tests are 100% mocked locally 👍

@asfalcone asfalcone commented on an outdated diff Mar 9, 2016
spaceship/lib/spaceship/tunes/application.rb
# @return [Hash] a hash, the version number being the key
def build_trains
Tunes::BuildTrain.all(self, self.apple_id)
end
+ # The numbers of all build trains that were uploaded
+ # @return [Array] An array of train version numbers
+ def all_build_train_numbers
+ client.all_build_trains(app_id: self.apple_id).fetch("trains").collect do |current|
+ current["versionString"]
+ end
+ end
+
+ # Receive the build details for a specific build
+ # useuful if the app is not listed in the TestFlight build list
@asfalcone
asfalcone Mar 9, 2016 Member

spelling -> useful

@lacostej lacostej commented on the diff Mar 9, 2016
spaceship/lib/spaceship/tunes/tunes_client.rb
@@ -574,6 +574,22 @@ def remove_testflight_build_from_review!(app_id: nil, train: nil, build_number:
handle_itc_response(r.body)
end
+ # All build trains, even if there is no TestFlight
+ def all_build_trains(app_id: nil)
+ r = request(:get, "ra/apps/#{app_id}/buildHistory?platform=ios")
@lacostej
lacostej Mar 9, 2016 Contributor

is this an ios specific feature ?

@KrauseFx
KrauseFx Mar 9, 2016 Member

I honestly don't know, haven't had time to look into this yet

@asfalcone asfalcone and 1 other commented on an outdated diff Mar 9, 2016
spaceship/spec/tunes/all_builds_spec.rb
+ before do
+ itc_stub_build_details
+ end
+
+ it "#all_build_train_numbers" do
+ result = app.all_build_train_numbers
+ expect(result).to eq(["2.0.1", "2.0"])
+ end
+
+ it "#all_builds_for_train" do
+ result = app.all_builds_for_train(train: "2.0.1").first
+ expect(result.apple_id).to eq("898536088")
+ expect(result.id).to eq(123123)
+ expect(result.build_version).to eq("4")
+ expect(result.train_version).to eq("2.0.1")
+ expect(result.train_version).to eq("2.0.1")
@asfalcone
asfalcone Mar 9, 2016 Member

is line 27 a copy-paste of 26?

@KrauseFx
KrauseFx Mar 9, 2016 Member

Nice catch 👍

@asfalcone
Member

LGTM, left 2 small comments. 👍

@KrauseFx KrauseFx Added access to build details of iTunes Connect
e2c1d81
@KrauseFx
Member
KrauseFx commented Mar 9, 2016

Squashed commits

@fastlane-danger-bot
1 Warning
⚠️ Big PR

Generated by 🚫 danger

@KrauseFx KrauseFx merged commit c34f2aa into master Mar 9, 2016

2 checks passed

ci/circleci Your tests passed on CircleCI!
Details
hound 7 violations found.
@lacostej lacostej commented on the diff Mar 9, 2016
spaceship/lib/spaceship/tunes/build_details.rb
@@ -0,0 +1,48 @@
+module Spaceship
+ module Tunes
+ # Represents the details of a build
+ class BuildDetails < TunesBase
+ # @return (String) The App identifier of this app, provided by iTunes Connect
+ # @example
+ # "1013943394"
+ attr_accessor :apple_id
+
+ # @return (String) Link to the dSYM file (not always available)
+ # lol, it's unencrypted http
@lacostej
lacostej Mar 9, 2016 Contributor

¯_(ツ)_/¯

@lacostej lacostej commented on the diff Mar 9, 2016
spaceship/lib/spaceship/tunes/build_details.rb
@@ -0,0 +1,48 @@
+module Spaceship
+ module Tunes
+ # Represents the details of a build
+ class BuildDetails < TunesBase
+ # @return (String) The App identifier of this app, provided by iTunes Connect
@lacostej
lacostej Mar 9, 2016 Contributor

@return [String]

(no rubocop for that ?)

@lacostej lacostej commented on the diff Mar 9, 2016
spaceship/lib/spaceship/tunes/build_details.rb
+ # @example
+ # "1013943394"
+ attr_accessor :apple_id
+
+ # @return (String) Link to the dSYM file (not always available)
+ # lol, it's unencrypted http
+ attr_accessor :dsym_url
+
+ # @return [Bool]
+ attr_accessor :include_symbols
+
+ # @return [Integer]
+ attr_accessor :number_of_asset_packs
+
+ # @return [Bool]
+ attr_accessor :contains_odr
@lacostej
lacostej Mar 9, 2016 Contributor

Mostly a comment: I was wondering what ODR was and this is what I found:

@KrauseFx
KrauseFx Mar 9, 2016 Member

I don't know what this is, how would you describe this value? It's been false for my apps.

@lacostej
lacostej Mar 9, 2016 Contributor

ODR might also mean: https://developer.apple.com/library/prerelease/ios/documentation/FileManagement/Conceptual/On_Demand_Resources_Guide/

So not really sure what they meant.

It would be interesting to see when it becomes true

@jcampbell05
jcampbell05 Mar 9, 2016 Contributor

I think for when you use on demand resources i.e for levels. So iOS can download it when you indicate when you need it.

@KrauseFx
KrauseFx Mar 10, 2016 Member

That sounds about right

@KrauseFx KrauseFx deleted the build-details branch Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment