@@ -565,13 +565,8 @@ def update_build_information!(app_id: nil,
565565 feedback_email : nil ,
566566 platform : 'ios' )
567567 url = "ra/apps/#{ app_id } /platforms/#{ platform } /trains/#{ train } /builds/#{ build_number } /testInformation"
568- r = request ( :get ) do |req |
569- req . url url
570- req . headers [ 'Content-Type' ] = 'application/json'
571- end
572- handle_itc_response ( r . body )
573568
574- build_info = r . body [ 'data' ]
569+ build_info = get_build_info_for_review ( app_id : app_id , train : train , build_number : build_number , platform : platform )
575570 build_info [ "details" ] . each do |current |
576571 current [ "whatsNew" ] [ "value" ] = whats_new if whats_new
577572 current [ "description" ] [ "value" ] = description if description
@@ -609,79 +604,70 @@ def submit_testflight_build_for_review!(app_id: nil, train: nil, build_number: n
609604 review_user_name : nil ,
610605 review_password : nil ,
611606 review_notes : nil ,
612- encryption : false )
607+ encryption : false ,
608+ encryption_updated : false ,
609+ is_exempt : false ,
610+ proprietary : false ,
611+ third_party : false )
613612
614613 build_info = get_build_info_for_review ( app_id : app_id , train : train , build_number : build_number , platform : platform )
615614 # Now fill in the values provided by the user
616615
617616 # First the localised values:
618- build_info [ 'testInfo' ] [ ' details'] . each do |current |
617+ build_info [ 'details' ] . each do |current |
619618 current [ 'whatsNew' ] [ 'value' ] = changelog if changelog
620619 current [ 'description' ] [ 'value' ] = description if description
621620 current [ 'feedbackEmail' ] [ 'value' ] = feedback_email if feedback_email
622621 current [ 'marketingUrl' ] [ 'value' ] = marketing_url if marketing_url
623622 current [ 'privacyPolicyUrl' ] [ 'value' ] = privacy_policy_url if privacy_policy_url
624623 current [ 'pageLanguageValue' ] = current [ 'language' ] # There is no valid reason why we need this, only iTC being iTC
625624 end
626- build_info [ 'significantChange' ] ||= { }
627- build_info [ 'significantChange' ] [ 'value' ] = significant_change
628- build_info [ 'testInfo' ] [ 'reviewFirstName' ] [ 'value' ] = first_name if first_name
629- build_info [ 'testInfo' ] [ 'reviewLastName' ] [ 'value' ] = last_name if last_name
630- build_info [ 'testInfo' ] [ 'reviewPhone' ] [ 'value' ] = phone_number if phone_number
631- build_info [ 'testInfo' ] [ 'reviewEmail' ] [ 'value' ] = review_email if review_email
632- build_info [ 'testInfo' ] [ 'reviewAccountRequired' ] [ 'value' ] = ( review_user_name . to_s + review_password . to_s ) . length > 0
633- build_info [ 'testInfo' ] [ 'reviewUserName' ] [ 'value' ] = review_user_name if review_user_name
634- build_info [ 'testInfo' ] [ 'reviewPassword' ] [ 'value' ] = review_password if review_password
635- build_info [ 'testInfo' ] [ 'reviewNotes' ] [ 'value' ] = review_notes if review_notes
625+
626+ review_info = {
627+ "significantChange" => {
628+ "value" => significant_change
629+ } ,
630+ "buildTestInformationTO" => build_info ,
631+ "exportComplianceTO" => {
632+ "usesEncryption" => {
633+ "value" => encryption
634+ } ,
635+ "encryptionUpdated" => {
636+ "value" => encryption_updated
637+ } ,
638+ "isExempt" => {
639+ "value" => is_exempt
640+ } ,
641+ "containsProprietaryCryptography" => {
642+ "value" => proprietary
643+ } ,
644+ "containsThirdPartyCryptography" => {
645+ "value" => third_party
646+ }
647+ }
648+ }
636649
637650 r = request ( :post ) do |req | # same URL, but a POST request
638- req . url "ra/apps/#{ app_id } /platforms/#{ platform } /trains/#{ train } /builds/#{ build_number } /submit/start "
651+ req . url "ra/apps/#{ app_id } /platforms/#{ platform } /trains/#{ train } /builds/#{ build_number } /review/submit "
639652
640- req . body = build_info . to_json
653+ req . body = review_info . to_json
641654 req . headers [ 'Content-Type' ] = 'application/json'
642655 end
643656 handle_itc_response ( r . body )
644-
645- encryption_info = r . body [ 'data' ]
646- update_encryption_compliance ( app_id : app_id ,
647- train : train ,
648- build_number : build_number ,
649- platform : platform ,
650- encryption_info : encryption_info ,
651- encryption : encryption )
652657 end
653658 # rubocop:enable Metrics/ParameterLists
654659
655660 def get_build_info_for_review ( app_id : nil , train : nil , build_number : nil , platform : 'ios' )
661+ url = "ra/apps/#{ app_id } /platforms/#{ platform } /trains/#{ train } /builds/#{ build_number } /testInformation"
656662 r = request ( :get ) do |req |
657- req . url "ra/apps/ #{ app_id } /platforms/ #{ platform } /trains/ #{ train } /builds/ #{ build_number } /submit/start"
663+ req . url url
658664 req . headers [ 'Content-Type' ] = 'application/json'
659665 end
660666 handle_itc_response ( r . body )
661667
662668 r . body [ 'data' ]
663669 end
664670
665- def update_encryption_compliance ( app_id : nil , train : nil , build_number : nil , platform : 'ios' , encryption_info : nil , encryption : nil , is_exempt : true , proprietary : false , third_party : false )
666- return unless encryption_info [ 'exportComplianceRequired' ]
667- # only sometimes this is required
668-
669- encryption_info [ 'usesEncryption' ] [ 'value' ] = encryption
670- encryption_info [ 'encryptionUpdated' ] ||= { }
671- encryption_info [ 'encryptionUpdated' ] [ 'value' ] = encryption
672- encryption_info [ 'isExempt' ] [ 'value' ] = is_exempt
673- encryption_info [ 'containsProprietaryCryptography' ] [ 'value' ] = proprietary
674- encryption_info [ 'containsThirdPartyCryptography' ] [ 'value' ] = third_party
675-
676- r = request ( :post ) do |req |
677- req . url "ra/apps/#{ app_id } /platforms/#{ platform } /trains/#{ train } /builds/#{ build_number } /submit/complete"
678- req . body = encryption_info . to_json
679- req . headers [ 'Content-Type' ] = 'application/json'
680- end
681-
682- handle_itc_response ( r . body )
683- end
684-
685671 #####################################################
686672 # @!group Submit for Review
687673 #####################################################
0 commit comments