Sha256: 11428dbf569ee23f65a584b0f57506760c2fe72e07921834bf304d3644f8e020

Contents?: true

Size: 1.15 KB

Versions: 85

Compression:

Stored size: 1.15 KB

Contents

module Spaceship
  module Tunes
    # Represents an image hosted on iTunes Connect. Used for icons, screenshots, etc
    class AppImage < TunesBase
      HOST_URL = "https://is1-ssl.mzstatic.com/image/thumb"

      attr_accessor :asset_token

      attr_accessor :sort_order

      attr_accessor :original_file_name

      attr_accessor :url

      attr_mapping(
        'assetToken' => :asset_token,
        'sortOrder' => :sort_order,
        'url' => :url,
        'originalFileName' => :original_file_name
      )

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

      def reset!(attrs = {})
        update_raw_data!(
          {
            asset_token: nil,
            original_file_name: nil,
            sort_order: nil,
            url: nil
          }.merge(attrs)
        )
      end

      def setup
        # Since September 2015 we don't get the url any more, so we have to manually build it
        self.url = "#{HOST_URL}/#{self.asset_token}/0x0ss.jpg"
      end

      private

      def update_raw_data!(hash)
        hash.each do |k, v|
          self.send("#{k}=", v)
        end
      end
    end
  end
end

Version data entries

85 entries across 85 versions & 1 rubygems

Version Path
spaceship-0.38.5 lib/spaceship/tunes/app_image.rb
spaceship-0.38.4 lib/spaceship/tunes/app_image.rb
spaceship-0.38.3 lib/spaceship/tunes/app_image.rb
spaceship-0.38.2 lib/spaceship/tunes/app_image.rb
spaceship-0.38.1 lib/spaceship/tunes/app_image.rb
spaceship-0.38.0 lib/spaceship/tunes/app_image.rb
spaceship-0.37.0 lib/spaceship/tunes/app_image.rb
spaceship-0.36.2 lib/spaceship/tunes/app_image.rb
spaceship-0.36.1 lib/spaceship/tunes/app_image.rb
spaceship-0.36.0 lib/spaceship/tunes/app_image.rb
spaceship-0.35.0 lib/spaceship/tunes/app_image.rb
spaceship-0.34.3 lib/spaceship/tunes/app_image.rb
spaceship-0.34.2 lib/spaceship/tunes/app_image.rb
spaceship-0.34.1 lib/spaceship/tunes/app_image.rb
spaceship-0.34.0 lib/spaceship/tunes/app_image.rb
spaceship-0.33.0 lib/spaceship/tunes/app_image.rb
spaceship-0.32.4 lib/spaceship/tunes/app_image.rb
spaceship-0.32.3 lib/spaceship/tunes/app_image.rb
spaceship-0.32.2 lib/spaceship/tunes/app_image.rb
spaceship-0.32.1 lib/spaceship/tunes/app_image.rb