lib/produce/itunes_connect.rb in produce-0.4.1 vs lib/produce/itunes_connect.rb in produce-0.4.2

- old
+ new

@@ -21,11 +21,11 @@ Helper.log.info "Creating new app '#{Produce.config[:app_name]}' on iTunes Connect".green Produce.config[:bundle_identifier_suffix] = '' unless wildcard_bundle? Spaceship::Tunes::Application.create!(name: Produce.config[:app_name], - primary_language: Produce.config[:language], + primary_language: language, version: Produce.config[:version], sku: Produce.config[:sku].to_s, # might be an int bundle_id: app_identifier, bundle_id_suffix: Produce.config[:bundle_identifier_suffix]) application = fetch_application @@ -46,8 +46,24 @@ return app_identifier.end_with?("*") end def app_identifier Produce.config[:app_identifier].to_s + end + + # Makes sure to get the value for the language + # Instead of using the user's value `UK English` spaceship should send + # `English_UK` to the server + def language + @language = Produce.config[:language] + + converted = Spaceship::Tunes::LanguageConverter.from_itc_readable_to_itc(@language) + @language = converted if converted # overwrite it with the actual value + + unless AvailableDefaultLanguages.all_languages.include?(@language) + raise "Please enter one of available languages: #{AvailableDefaultLanguages.all_languages}".red + end + + return @language end end end