Sha256: 36df4e5bde51d613048f98df9034a27a4429b1cf4d911527fafadf8f71d5f0f3

Contents?: true

Size: 1.72 KB

Versions: 109

Compression:

Stored size: 1.72 KB

Contents

module Spaceship
  module Tunes
    class IAPFamilyDetails < TunesBase
      # @return (Spaceship::Tunes::Application) A reference to the application
      attr_accessor :application

      # @return (String) the family name
      attr_accessor :name

      # @return (Intger) the Family Id
      attr_accessor :family_id

      attr_mapping({
        'id' => :family_id,
        'name.value' => :name
      })

      class << self
        def factory(attrs)
          return self.new(attrs)
        end
      end

      # @return (Hash) localized names
      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"]
          }
        end
        return parsed_versions
      end

      # modify existing family
      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 }
                               }
                            }
        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
    end
  end
end

Version data entries

109 entries across 109 versions & 1 rubygems

Version Path
fastlane-2.25.0.beta.20170403010018 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.25.0.beta.20170402010035 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.25.0.beta.20170401010021 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.25.0.beta.20170331010039 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.25.0.beta.20170330225747 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.24.0 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.24.0.beta.20170330010023 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.24.0.beta.20170329010023 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.24.0.beta.20170328010037 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.24.0.beta.20170327010009 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.24.0.beta.20170326010023 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.24.0.beta.20170325010032 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.23.0 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.23.0.beta.20170322010036 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.22.0 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.22.0.beta.20170321010023 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.21.0 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.21.0.beta.20170320010043 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.21.0.beta.20170319010027 spaceship/lib/spaceship/tunes/iap_family_details.rb
fastlane-2.21.0.beta.20170318010107 spaceship/lib/spaceship/tunes/iap_family_details.rb