Class: Spaceship::Tunes::AppVersion

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

Overview

Represents an editable version of an iTunes Connect Application This can either be the live or the edit version retrieved via the app

Instance Attribute Summary collapse

Attributes inherited from Base

#raw_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from TunesBase

client

Methods inherited from Base

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

Constructor Details

This class inherits a constructor from Spaceship::Base

Instance Attribute Details

#app_icon_original_nameString

Returns Name of the original file.

Returns:

  • (String)

    Name of the original file



61
62
63
# File 'lib/spaceship/tunes/app_version.rb', line 61

def app_icon_original_name
  @app_icon_original_name
end

#app_icon_urlString

Returns URL to the full resolution 1024x1024 app icon.

Returns:

  • (String)

    URL to the full resolution 1024x1024 app icon



58
59
60
# File 'lib/spaceship/tunes/app_version.rb', line 58

def app_icon_url
  @app_icon_url
end

#app_statusSpaceship::Tunes::AppStatus (readonly)

Returns What’s the current status of this app e.g. Waiting for Review, Ready for Sale, …

Returns:



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

def app_status
  @app_status
end

#applicationSpaceship::Tunes::Application

Returns A reference to the application this version is for.

Returns:



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

def application
  @application
end

#can_beta_testBool

Returns:

  • (Bool)


52
53
54
# File 'lib/spaceship/tunes/app_version.rb', line 52

def can_beta_test
  @can_beta_test
end

#can_prepare_for_uploadBool

Returns:

  • (Bool)


43
44
45
# File 'lib/spaceship/tunes/app_version.rb', line 43

def can_prepare_for_upload
  @can_prepare_for_upload
end

#can_reject_versionBool

Returns:

  • (Bool)


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

def can_reject_version
  @can_reject_version
end

#can_send_version_liveBool

Returns:

  • (Bool)


46
47
48
# File 'lib/spaceship/tunes/app_version.rb', line 46

def can_send_version_live
  @can_send_version_live
end

Returns The copyright information of this app.

Returns:

  • (String)

    The copyright information of this app



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

def copyright
  @copyright
end

#descriptionHash (readonly)

Returns A hash representing the description in all languages.

Returns:

  • (Hash)

    A hash representing the description in all languages



110
111
112
# File 'lib/spaceship/tunes/app_version.rb', line 110

def description
  @description
end

#is_liveBool

Returns Is that the version that’s currently available in the App Store?.

Returns:

  • (Bool)

    Is that the version that’s currently available in the App Store?



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

def is_live
  @is_live
end

#keywordsHash (readonly)

Returns A hash representing the keywords in all languages.

Returns:

  • (Hash)

    A hash representing the keywords in all languages



107
108
109
# File 'lib/spaceship/tunes/app_version.rb', line 107

def keywords
  @keywords
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



101
102
103
# File 'lib/spaceship/tunes/app_version.rb', line 101

def languages
  @languages
end

#marketing_urlHash (readonly)

Returns A hash representing the keywords in all languages.

Returns:

  • (Hash)

    A hash representing the keywords in all languages



122
123
124
# File 'lib/spaceship/tunes/app_version.rb', line 122

def marketing_url
  @marketing_url
end

#nameHash (readonly)

Returns A hash representing the app name in all languages.

Returns:

  • (Hash)

    A hash representing the app name in all languages



104
105
106
# File 'lib/spaceship/tunes/app_version.rb', line 104

def name
  @name
end

#primary_categoryObject

Categories (e.g. MZGenre.Business)



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

def primary_category
  @primary_category
end

#primary_first_sub_categoryObject

Returns the value of attribute primary_first_sub_category.



26
27
28
# File 'lib/spaceship/tunes/app_version.rb', line 26

def primary_first_sub_category
  @primary_first_sub_category
end

#primary_second_sub_categoryObject

Returns the value of attribute primary_second_sub_category.



28
29
30
# File 'lib/spaceship/tunes/app_version.rb', line 28

def primary_second_sub_category
  @primary_second_sub_category
end

#privacy_urlHash (readonly)

Returns A hash representing the keywords in all languages.

Returns:

  • (Hash)

    A hash representing the keywords in all languages



116
117
118
# File 'lib/spaceship/tunes/app_version.rb', line 116

def privacy_url
  @privacy_url
end

#raw_statusString

Returns App Status (e.g. ‘readyForSale’). You should use ‘app_status` instead.

Returns:

  • (String)

    App Status (e.g. ‘readyForSale’). You should use ‘app_status` instead



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

def raw_status
  @raw_status
end

#release_notesHash (readonly)

Returns The changelog.

Returns:

  • (Hash)

    The changelog



113
114
115
# File 'lib/spaceship/tunes/app_version.rb', line 113

def release_notes
  @release_notes
end

#release_on_approvalObject

These methods takes care of properly parsing values that are not returned in the right format, e.g. boolean as string



49
50
51
# File 'lib/spaceship/tunes/app_version.rb', line 49

def release_on_approval
  @release_on_approval
end

#review_demo_passwordString

Returns App Review Information Demo Account Password.

Returns:

  • (String)

    App Review Information Demo Account Password



91
92
93
# File 'lib/spaceship/tunes/app_version.rb', line 91

def review_demo_password
  @review_demo_password
end

#review_demo_userString

Returns App Review Information Demo Account User Name.

Returns:

  • (String)

    App Review Information Demo Account User Name



88
89
90
# File 'lib/spaceship/tunes/app_version.rb', line 88

def review_demo_user
  @review_demo_user
end

#review_emailString

Returns App Review Information Email Address.

Returns:

  • (String)

    App Review Information Email Address



85
86
87
# File 'lib/spaceship/tunes/app_version.rb', line 85

def review_email
  @review_email
end

#review_first_nameString

App Review Information

Returns:

  • (String)

    App Review Information First Name



76
77
78
# File 'lib/spaceship/tunes/app_version.rb', line 76

def review_first_name
  @review_first_name
end

#review_last_nameString

Returns App Review Information Last Name.

Returns:

  • (String)

    App Review Information Last Name



79
80
81
# File 'lib/spaceship/tunes/app_version.rb', line 79

def review_last_name
  @review_last_name
end

#review_notesString

Returns App Review Information Notes.

Returns:

  • (String)

    App Review Information Notes



94
95
96
# File 'lib/spaceship/tunes/app_version.rb', line 94

def review_notes
  @review_notes
end

#review_phone_numberString

Returns App Review Information Phone Number.

Returns:

  • (String)

    App Review Information Phone Number



82
83
84
# File 'lib/spaceship/tunes/app_version.rb', line 82

def review_phone_number
  @review_phone_number
end

#screenshotsHash (readonly)

Returns Represents the screenshots of this app version (read-only).

Returns:

  • (Hash)

    Represents the screenshots of this app version (read-only)



125
126
127
# File 'lib/spaceship/tunes/app_version.rb', line 125

def screenshots
  @screenshots
end

#secondary_categoryObject

Returns the value of attribute secondary_category.



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

def secondary_category
  @secondary_category
end

#secondary_first_sub_categoryObject

Returns the value of attribute secondary_first_sub_category.



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

def secondary_first_sub_category
  @secondary_first_sub_category
end

#secondary_second_sub_categoryObject

Returns the value of attribute secondary_second_sub_category.



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

def secondary_second_sub_category
  @secondary_second_sub_category
end

#support_urlHash (readonly)

Returns A hash representing the keywords in all languages.

Returns:

  • (Hash)

    A hash representing the keywords in all languages



119
120
121
# File 'lib/spaceship/tunes/app_version.rb', line 119

def support_url
  @support_url
end

#supports_apple_watchBool

Returns Does the binary contain a watch binary?.

Returns:

  • (Bool)

    Does the binary contain a watch binary?



55
56
57
# File 'lib/spaceship/tunes/app_version.rb', line 55

def supports_apple_watch
  @supports_apple_watch
end

#versionString

Returns The version number of this version.

Returns:

  • (String)

    The version number of this version



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

def version
  @version
end

#version_idInteger

Returns a unqiue ID for this version generated by iTunes Connect.

Returns:

  • (Integer)

    a unqiue ID for this version generated by iTunes Connect



70
71
72
# File 'lib/spaceship/tunes/app_version.rb', line 70

def version_id
  @version_id
end

#watch_app_icon_original_nameString

Returns Name of the original file.

Returns:

  • (String)

    Name of the original file



67
68
69
# File 'lib/spaceship/tunes/app_version.rb', line 67

def watch_app_icon_original_name
  @watch_app_icon_original_name
end

#watch_app_icon_urlString

Returns URL to the full resolution 1024x1024 app icon.

Returns:

  • (String)

    URL to the full resolution 1024x1024 app icon



64
65
66
# File 'lib/spaceship/tunes/app_version.rb', line 64

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



164
165
166
167
168
169
170
# File 'lib/spaceship/tunes/app_version.rb', line 164

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

  return obj
end

.find(application, app_id, is_live = false) ⇒ Object

Parameters:

  • application (Spaceship::Tunes::Application)

    The app this version is for

  • app_id (String)

    The unique Apple ID of this app

  • is_live (Boolean) (defaults to: false)

    Is that the version that’s live in the App Store?



175
176
177
178
179
180
181
# File 'lib/spaceship/tunes/app_version.rb', line 175

def find(application, app_id, is_live = false)
  attrs = client.app_version(app_id, is_live)
  attrs.merge!(application: application)
  attrs.merge!(is_live: is_live)

  return self.factory(attrs)
end

Instance Method Details

#is_live?Bool

Returns Is that version currently available in the App Store?.

Returns:

  • (Bool)

    Is that version currently available in the App Store?



185
186
187
# File 'lib/spaceship/tunes/app_version.rb', line 185

def is_live?
  is_live
end

#save!Object

Push all changes that were made back to iTunes Connect



223
224
225
# File 'lib/spaceship/tunes/app_version.rb', line 223

def save!
  client.update_app_version!(application.apple_id, is_live?, raw_data)
end

#setupObject

Private methods



234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/spaceship/tunes/app_version.rb', line 234

def setup
  # Properly parse the AppStatus
  status = raw_data['status']
  @app_status = Tunes::AppStatus.get_from_string(status)

  # Setup the screenshots
  @screenshots = {}
  raw_data['details']['value'].each do |row|
    # Now that's one language right here
    @screenshots[row['language']] = setup_screenshots(row)
  end
end

#unfold_languagesObject

Prefill name, keywords, etc…



249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/spaceship/tunes/app_version.rb', line 249

def unfold_languages
  {
    name: :name,
    keywords: :keywords,
    description: :description,
    privacyURL: :privacy_url,
    supportURL: :support_url,
    marketingURL: :marketing_url,
    releaseNotes: :release_notes
  }.each do |json, attribute|
    instance_variable_set("@#{attribute}".to_sym, LanguageItem.new(json, languages))
  end
end

#urlString

Returns An URL to this specific resource. You can enter this URL into your browser.

Returns:

  • (String)

    An URL to this specific resource. You can enter this URL into your browser



228
229
230
# File 'lib/spaceship/tunes/app_version.rb', line 228

def url
  "https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{self.application.apple_id}/" + (self.is_live? ? "cur" : "")
end