Class: Spaceship::Tunes::AppDetails

Inherits:
TunesBase show all
Defined in:
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 Some bla bla about privacy.

Returns:

  • (Hash)

    Some bla bla about privacy



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

def apple_tv_privacy_policy
  @apple_tv_privacy_policy
end

#applicationObject

Returns the value of attribute application.



4
5
6
# File 'lib/spaceship/tunes/app_details.rb', line 4

def application
  @application
end

#available_primary_locale_codesObject

Returns the value of attribute available_primary_locale_codes.



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

def available_primary_locale_codes
  @available_primary_locale_codes
end

#languagesArray

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

Returns:

  • (Array)

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



11
12
13
# File 'lib/spaceship/tunes/app_details.rb', line 11

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



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

def name
  @name
end

#primary_categoryObject

Categories (e.g. MZGenre.Business)



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

def primary_category
  @primary_category
end

#primary_first_sub_categoryObject

Returns the value of attribute primary_first_sub_category.



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

def primary_first_sub_category
  @primary_first_sub_category
end

#primary_locale_codeObject

Returns the value of attribute primary_locale_code.



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

def primary_locale_code
  @primary_locale_code
end

#primary_second_sub_categoryObject

Returns the value of attribute primary_second_sub_category.



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

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



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

def privacy_url
  @privacy_url
end

#secondary_categoryObject

Returns the value of attribute secondary_category.



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

def secondary_category
  @secondary_category
end

#secondary_first_sub_categoryObject

Returns the value of attribute secondary_first_sub_category.



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

def secondary_first_sub_category
  @secondary_first_sub_category
end

#secondary_second_sub_categoryObject

Returns the value of attribute secondary_second_sub_category.



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

def secondary_second_sub_category
  @secondary_second_sub_category
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.



54
55
56
57
58
59
# File 'lib/spaceship/tunes/app_details.rb', line 54

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 iTunes Connect



74
75
76
77
78
79
80
81
82
# File 'lib/spaceship/tunes/app_details.rb', line 74

def save!
  client.update_app_details!(application.apple_id, raw_data)
rescue Spaceship::TunesClient::ITunesConnectError => 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



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

def setup; end

#unfold_languagesObject

Prefill name, privacy url



63
64
65
66
67
68
69
70
71
# File 'lib/spaceship/tunes/app_details.rb', line 63

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