spaceship/lib/spaceship/tunes/iap_family_details.rb in fastlane-2.29.0.beta.20170501010050 vs spaceship/lib/spaceship/tunes/iap_family_details.rb in fastlane-2.29.0.beta.20170502010055
- old
+ new
@@ -20,10 +20,29 @@
def factory(attrs)
return self.new(attrs)
end
end
+ def versions=(value = {})
+ if value.kind_of?(Array)
+ # input that comes from iTC api
+ return
+ end
+ new_versions = []
+ value.each do |language, current_version|
+ new_versions << {
+ "value" => {
+ "subscriptionName" => { "value" => current_version[:subscription_name] },
+ "name" => { "value" => current_version[:name] },
+ "localeCode" => { "value" => language }
+ }
+ }
+ end
+
+ raw_data.set(["details"], { "value" => new_versions })
+ end
+
# @return (Hash) localized names
def versions
parsed_versions = {}
raw_versions = raw_data["details"]["value"]
raw_versions.each do |version|
@@ -40,18 +59,18 @@
def save!
# Transform localization versions back to original format.
versions_array = []
versions.each do |language_code, value|
versions_array << {
- value: {
- subscriptionName: { value: value[:subscription_name] },
- name: { value: value[:name] },
- localeCode: { value: language_code.to_s }
+ "value" => {
+ "subscriptionName" => { "value" => value[:subscription_name] },
+ "name" => { "value" => value[:name] },
+ "localeCode" => { "value" => language_code.to_s }
}
}
end
- raw_data.set(["details"], { value: versions_array })
+ raw_data.set(["details"], { "value" => versions_array })
client.update_iap_family!(app_id: application.apple_id, family_id: self.family_id, data: raw_data)
end
end
end