lib/spaceship/tunes/application.rb in spaceship-0.21.0 vs lib/spaceship/tunes/application.rb in spaceship-0.21.1
- old
+ new
@@ -9,15 +9,10 @@
# @return (String) The name you provided for this app (in the default language)
# @example
# "Spaceship App"
attr_accessor :name
- # @return (String) the supported platform of this app
- # @example
- # "ios"
- attr_accessor :platform
-
# @return (String) The Vendor ID provided by iTunes Connect
# @example
# "1435592086"
attr_accessor :vendor_id
@@ -40,11 +35,10 @@
attr_accessor :app_icon_preview_url
attr_mapping(
'adamId' => :apple_id,
'name' => :name,
- 'appType' => :platform,
'vendorId' => :vendor_id,
'bundleId' => :bundle_id,
'lastModifiedDate' => :last_modified,
'issuesCount' => :issues_count,
'iconUrl' => :app_icon_preview_url
@@ -98,29 +92,22 @@
#####################################################
# @return (Spaceship::AppVersion) Receive the version that is currently live on the
# App Store. You can't modify all values there, so be careful.
def live_version
- if (raw_data['versions'] || []).count == 1
- v = raw_data['versions'].last
- if ['Prepare for Upload', 'prepareForUpload'].include?(v['state']) # this only applies for the initial version
- return nil
- end
- end
-
Spaceship::AppVersion.find(self, self.apple_id, true)
end
# @return (Spaceship::AppVersion) Receive the version that can fully be edited
def edit_version
Spaceship::AppVersion.find(self, self.apple_id, false)
end
# @return (Spaceship::AppVersion) This will return the `edit_version` if available
- # and fallback to the `edit_version`. Use this to just access the latest data
+ # and fallback to the `live_version`. Use this to just access the latest data
def latest_version
- edit_version || live_version || Spaceship::AppVersion.find(self, self.apple_id, false) # we want to get *any* version, prefered the latest one
+ edit_version || live_version
end
# @return (String) An URL to this specific resource. You can enter this URL into your browser
def url
"https://itunesconnect.apple.com/WebObjects/iTunesConnect.woa/ra/ng/app/#{self.apple_id}"
@@ -129,9 +116,17 @@
# @return (Hash) Contains the reason for rejection.
# if everything is alright, the result will be
# `{"sectionErrorKeys"=>[], "sectionInfoKeys"=>[], "sectionWarningKeys"=>[], "replyConstraints"=>{"minLength"=>1, "maxLength"=>4000}, "appNotes"=>{"threads"=>[]}, "betaNotes"=>{"threads"=>[]}, "appMessages"=>{"threads"=>[]}}`
def resolution_center
client.get_resolution_center(apple_id, platform)
+ end
+
+ # kept for backward compatibility
+ # tries to guess the platform of the currently submitted apps
+ # note that as ITC now supports multiple app types, this might break
+ # if your app supports more than one
+ def platform
+ Spaceship::Tunes::AppVersionCommon.find_platform(raw_data['versionSets'])['platformString']
end
def details
attrs = client.app_details(apple_id)
attrs.merge!(application: self)