Class: Spaceship::Tunes::AppDetails

Inherits:
TunesBase show all
Defined in:
spaceship/lib/spaceship/tunes/app_details.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#client, #raw_data

General collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TunesBase

client

Methods inherited from Base

attr_accessor, attr_mapping, attributes, #attributes, #initialize, #inspect, mapping_module, method_missing, set_client, #to_s

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#apple_tv_privacy_policyHash (readonly)

Returns A hash representing the privacy URL in all languages for Apple TV.

Returns:

  • (Hash)

    A hash representing the privacy URL in all languages for Apple TV



27
28
29
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 27

def apple_tv_privacy_policy
  @apple_tv_privacy_policy
end

#applicationObject

Returns the value of attribute application.



8
9
10
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 8

def application
  @application
end

#available_primary_locale_codesObject

Returns the value of attribute available_primary_locale_codes.



44
45
46
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 44

def available_primary_locale_codes
  @available_primary_locale_codes
end

#languagesArray

Returns Raw access the all available languages. You shouldn’t use it probably.

Returns:

  • (Array)

    Raw access the all available languages. You shouldn’t use it probably



15
16
17
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 15

def languages
  @languages
end

#nameHash (readonly)

Returns A hash representing the app name in all languages.

Returns:

  • (Hash)

    A hash representing the app name in all languages



18
19
20
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 18

def name
  @name
end

#primary_categoryObject

Categories (e.g. MZGenre.Business)



30
31
32
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 30

def primary_category
  @primary_category
end

#primary_first_sub_categoryObject

Returns the value of attribute primary_first_sub_category.



32
33
34
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 32

def primary_first_sub_category
  @primary_first_sub_category
end

#primary_locale_codeObject

Returns the value of attribute primary_locale_code.



42
43
44
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 42

def primary_locale_code
  @primary_locale_code
end

#primary_second_sub_categoryObject

Returns the value of attribute primary_second_sub_category.



34
35
36
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 34

def primary_second_sub_category
  @primary_second_sub_category
end

#privacy_urlHash (readonly)

Returns A hash representing the privacy URL in all languages.

Returns:

  • (Hash)

    A hash representing the privacy URL in all languages



24
25
26
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 24

def privacy_url
  @privacy_url
end

#secondary_categoryObject

Returns the value of attribute secondary_category.



36
37
38
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 36

def secondary_category
  @secondary_category
end

#secondary_first_sub_categoryObject

Returns the value of attribute secondary_first_sub_category.



38
39
40
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 38

def secondary_first_sub_category
  @secondary_first_sub_category
end

#secondary_second_sub_categoryObject

Returns the value of attribute secondary_second_sub_category.



40
41
42
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 40

def secondary_second_sub_category
  @secondary_second_sub_category
end

#subtitleHash (readonly)

Returns A hash representing the subtitle in all languages.

Returns:

  • (Hash)

    A hash representing the subtitle in all languages



21
22
23
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 21

def subtitle
  @subtitle
end

Class Method Details

.factory(attrs) ⇒ Object

Create a new object based on a hash. This is used to create a new object based on the server response.



61
62
63
64
65
66
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 61

def factory(attrs)
  obj = self.new(attrs)
  obj.unfold_languages

  return obj
end

Instance Method Details

#save!Object

Push all changes that were made back to App Store Connect



82
83
84
85
86
87
88
89
90
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 82

def save!
  client.update_app_details!(application.apple_id, raw_data)
rescue Spaceship::Tunes::Error => ex
  if ex.to_s == "operation_failed"
    # That's alright, we get this error message if nothing has changed
  else
    raise ex
  end
end

#setupObject



133
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 133

def setup; end

#unfold_languagesObject

Prefill name, privacy url



70
71
72
73
74
75
76
77
78
79
# File 'spaceship/lib/spaceship/tunes/app_details.rb', line 70

def unfold_languages
  {
    name: :name,
    subtitle: :subtitle,
    privacyPolicyUrl: :privacy_url,
    privacyPolicy: :apple_tv_privacy_policy
  }.each do |json, attribute|
    instance_variable_set("@#{attribute}".to_sym, LanguageItem.new(json, languages))
  end
end