lib/spaceship/tunes/build.rb in spaceship-0.1.2 vs lib/spaceship/tunes/build.rb in spaceship-0.2.0

- old
+ new

@@ -5,20 +5,20 @@ ##################################################### # @!group General metadata ##################################################### - # @return (Spaceship::Tunes::Application) A reference to the build train this build is contained in + # @return (Spaceship::Tunes::BuildTrain) A reference to the build train this build is contained in attr_accessor :build_train # @return (Integer) The ID generated by iTunes Connect attr_accessor :id # @return (Boolean) attr_accessor :valid - # @return (String) The build version (not the version number) + # @return (String) The build version (not the version number), but also is named `build number` attr_accessor :build_version # @return (String) The version number (e.g. 1.3) attr_accessor :train_version @@ -26,11 +26,11 @@ attr_accessor :upload_date # @return (String) URL to the app icon of this build (150x150px) attr_accessor :icon_url - # @return (String) + # @return (String) The name of the app this build is for attr_accessor :app_name # @return (String) The platform of this build (e.g. 'ios') attr_accessor :platform @@ -101,9 +101,68 @@ def setup super @external_testing_enabled = (self.external_expiry_date || 0) > 0 + end + + # This will submit this build for TestFlight beta review + # @param metadata [Hash] A hash containing the following information (keys must be symbols): + # { + # # Required Metadata: + # changelog: "Changelog", + # description: "Your Description", + # feedback_email: "Email Address for Feedback", + # marketing_url: "https://marketing.com", + # first_name: "Felix", + # last_name: "Krause", + # review_email: "Contact email address for Apple", + # phone_number: "0128383383", + # + # # Optional Metadata: + # privacy_policy_url: nil, + # review_notes: nil, + # review_user_name: nil, + # review_password: nil, + # encryption: false + # } + def submit_for_beta_review!(metadata) + # First, enable beta testing for this train (per iTC requirement) + self.build_train.update_testing_status!(true) + + parameters = { + app_id: self.build_train.application.apple_id, + train: self.build_train.version_string, + build_number: self.build_version, + + # Required Metadata: + changelog: "No changelog provided", + description: "No app description provided", + feedback_email: "contact@company.com", + marketing_url: "http://marketing.com", + first_name: "Felix", + last_name: "Krause", + review_email: "contact@company.com", + phone_number: "0123456789", + + # Optional Metadata: + privacy_policy_url: nil, + review_notes: nil, + review_user_name: nil, + review_password: nil, + encryption: false + }.merge(metadata) + + client.submit_testflight_build_for_review!(parameters) + + return parameters + end + + # This will cancel the review process for this TestFlight build + def cancel_beta_review! + client.remove_testflight_build_from_review!(app_id: self.build_train.application.apple_id, + train: self.build_train.version_string, + build_number: self.build_version) end end end end