lib/spaceship/tunes/application.rb in spaceship-0.9.1 vs lib/spaceship/tunes/application.rb in spaceship-0.10.0

- old
+ new

@@ -163,9 +163,28 @@ client.create_version!(apple_id, version_number) # Future: implemented -reload method end + # Will make sure the current edit_version matches the given version number + # This will either create a new version or change the version number + # from an existing version + # @return (Bool) Was something changed? + def ensure_version!(version_number) + if (e = edit_version) + if e.version.to_s != version_number.to_s + # Update an existing version + e.version = version_number + e.save! + return true + end + return false + else + create_version!(version_number) + return true + end + end + # set the price tier. This method doesn't require `save` to be called def update_price_tier!(price_tier) client.update_price_tier!(self.apple_id, price_tier) end