class Spaceship::Tunes::IAPFamilyDetails
Attributes
application[RW]
@return (Spaceship::Tunes::Application
) A reference to the application
family_details[RW]
@return (Array
) of all in-app purchase family details
family_id[RW]
@return (Intger) the family id
iap_count[RW]
@return (Intger) amount of linked in-app purchases of this family (read-only)
linked_iaps[RW]
@return (Array
) all linked in-app purchases of this family
name[RW]
@return (String
) the family name
Public Instance Methods
save!()
click to toggle source
modify existing family
# File spaceship/lib/spaceship/tunes/iap_family_details.rb, line 70 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 }, "id" => value[:id] } } end 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
versions()
click to toggle source
@return (Hash
) localized names
# File spaceship/lib/spaceship/tunes/iap_family_details.rb, line 33 def versions parsed_versions = {} raw_versions = raw_data["details"]["value"] raw_versions.each do |version| language = version["value"]["localeCode"]["value"] parsed_versions[language.to_sym] = { subscription_name: version["value"]["subscriptionName"]["value"], name: version["value"]["name"]["value"], id: version["value"]["id"], status: version["value"]["status"] } end return parsed_versions end
versions=(value = {})
click to toggle source
transforms user-set versions to iTC ones
# File spaceship/lib/spaceship/tunes/iap_family_details.rb, line 49 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 }, "id" => current_version[:id] } } end raw_data.set(["details"], { "value" => new_versions }) end