Class: Spaceship::ConnectAPI::App
- Inherits:
-
Object
- Object
- Spaceship::ConnectAPI::App
- Includes:
- Model
- Defined in:
- spaceship/lib/spaceship/connect_api/models/app.rb
Defined Under Namespace
Modules: ContentRightsDeclaration
Instance Attribute Summary collapse
-
#app_store_versions ⇒ Object
Returns the value of attribute app_store_versions.
-
#bundle_id ⇒ Object
Returns the value of attribute bundle_id.
-
#content_rights_declaration ⇒ Object
Returns the value of attribute content_rights_declaration.
-
#is_aag ⇒ Object
Returns the value of attribute is_aag.
-
#name ⇒ Object
Returns the value of attribute name.
-
#primary_locale ⇒ Object
Returns the value of attribute primary_locale.
-
#removed ⇒ Object
Returns the value of attribute removed.
-
#sku ⇒ Object
Returns the value of attribute sku.
Attributes included from Model
Class Method Summary collapse
-
.all(filter: {}, includes: "appStoreVersions", limit: nil, sort: nil) ⇒ Object
Apps.
- .create(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil) ⇒ Object
- .find(bundle_id) ⇒ Object
- .get(app_id: nil, includes: "appStoreVersions") ⇒ Object
- .type ⇒ Object
Instance Method Summary collapse
-
#add_users(user_ids: nil) ⇒ Object
Users.
- #create_beta_group(group_name: nil, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false) ⇒ Object
-
#ensure_version!(version_string, platform: nil) ⇒ Bool
Will make sure the current edit_version matches the given version number This will either create a new version or change the version number from an existing version.
-
#fetch_app_prices(filter: {}, includes: "priceTier", limit: nil, sort: nil) ⇒ Object
App Pricing.
-
#fetch_edit_app_info ⇒ Object
App Info.
- #get_app_store_versions(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
- #get_beta_app_localizations(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
-
#get_beta_feedback(filter: {}, includes: "tester,build,screenshots", limit: nil, sort: nil) ⇒ Object
Beta Feedback.
- #get_beta_groups(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
-
#get_beta_testers(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
Beta Testers.
- #get_build_deliveries(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
-
#get_builds(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
Builds.
- #get_edit_app_store_version(platform: nil, includes: nil) ⇒ Object
- #get_live_app_store_version(platform: nil, includes: nil) ⇒ Object
-
#reject_version_if_possible! ⇒ Object
App Store Versions.
- #update(attributes: nil, app_price_tier_id: nil, territory_ids: nil) ⇒ Object
Methods included from Model
#attr_mapping, included, #initialize, #to_json, #update_attributes
Instance Attribute Details
#app_store_versions ⇒ Object
Returns the value of attribute app_store_versions.
18 19 20 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 18 def app_store_versions @app_store_versions end |
#bundle_id ⇒ Object
Returns the value of attribute bundle_id.
10 11 12 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 10 def bundle_id @bundle_id end |
#content_rights_declaration ⇒ Object
Returns the value of attribute content_rights_declaration.
16 17 18 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 16 def content_rights_declaration @content_rights_declaration end |
#is_aag ⇒ Object
Returns the value of attribute is_aag.
14 15 16 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 14 def is_aag @is_aag end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 9 def name @name end |
#primary_locale ⇒ Object
Returns the value of attribute primary_locale.
12 13 14 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 12 def primary_locale @primary_locale end |
#removed ⇒ Object
Returns the value of attribute removed.
13 14 15 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 13 def removed @removed end |
#sku ⇒ Object
Returns the value of attribute sku.
11 12 13 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 11 def sku @sku end |
Class Method Details
.all(filter: {}, includes: "appStoreVersions", limit: nil, sort: nil) ⇒ Object
Apps
46 47 48 49 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 46 def self.all(filter: {}, includes: "appStoreVersions", limit: nil, sort: nil) resps = Spaceship::ConnectAPI.get_apps(filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
.create(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 57 def self.create(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil) Spaceship::ConnectAPI.post_app( name: name, version_string: version_string, sku: sku, primary_locale: primary_locale, bundle_id: bundle_id, platforms: platforms, company_name: company_name ) end |
.find(bundle_id) ⇒ Object
51 52 53 54 55 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 51 def self.find(bundle_id) return all(filter: { bundleId: bundle_id }).find do |app| app.bundle_id == bundle_id end end |
.get(app_id: nil, includes: "appStoreVersions") ⇒ Object
69 70 71 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 69 def self.get(app_id: nil, includes: "appStoreVersions") return Spaceship::ConnectAPI.get_app(app_id: app_id, includes: includes).first end |
.type ⇒ Object
38 39 40 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 38 def self.type return "apps" end |
Instance Method Details
#add_users(user_ids: nil) ⇒ Object
Users
264 265 266 267 268 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 264 def add_users(user_ids: nil) user_ids.each do |user_id| Spaceship::ConnectAPI.add_user_visible_apps(user_id: user_id, app_ids: [id]) end end |
#create_beta_group(group_name: nil, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false) ⇒ Object
249 250 251 252 253 254 255 256 257 258 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 249 def create_beta_group(group_name: nil, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false) resps = Spaceship::ConnectAPI.create_beta_group( app_id: id, group_name: group_name, public_link_enabled: public_link_enabled, public_link_limit: public_link_limit, public_link_limit_enabled: public_link_limit_enabled ).all_pages return resps.flat_map(&:to_models).first end |
#ensure_version!(version_string, platform: nil) ⇒ Bool
Will make sure the current edit_version matches the given version number This will either create a new version or change the version number from an existing version
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 137 def ensure_version!(version_string, platform: nil) app_store_version = get_edit_app_store_version(platform: platform) if app_store_version if version_string != app_store_version.version_string attributes = { versionString: version_string } app_store_version.update(attributes: attributes) return true end return false else attributes = { versionString: version_string, platform: platform } Spaceship::ConnectAPI.post_app_store_version(app_id: id, attributes: attributes) return true end end |
#fetch_app_prices(filter: {}, includes: "priceTier", limit: nil, sort: nil) ⇒ Object
App Pricing
102 103 104 105 106 107 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 102 def fetch_app_prices(filter: {}, includes: "priceTier", limit: nil, sort: nil) filter ||= {} filter[:app] = id resp = Spaceship::ConnectAPI.get_app_prices(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort) return resp.to_models end |
#fetch_edit_app_info ⇒ Object
App Info
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 81 def fetch_edit_app_info states = [ Spaceship::ConnectAPI::AppInfo::AppStoreState::PREPARE_FOR_SUBMISSION, Spaceship::ConnectAPI::AppInfo::AppStoreState::DEVELOPER_REJECTED, Spaceship::ConnectAPI::AppInfo::AppStoreState::REJECTED, Spaceship::ConnectAPI::AppInfo::AppStoreState::METADATA_REJECTED, Spaceship::ConnectAPI::AppInfo::AppStoreState::WAITING_FOR_REVIEW, Spaceship::ConnectAPI::AppInfo::AppStoreState::INVALID_BINARY ] filter = { app: id } resp = Spaceship::ConnectAPI.get_app_infos(filter: filter) return resp.to_models.select do |model| states.include?(model.app_store_state) end.first end |
#get_app_store_versions(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
184 185 186 187 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 184 def get_app_store_versions(filter: {}, includes: nil, limit: nil, sort: nil) resps = Spaceship::ConnectAPI.get_app_store_versions(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
#get_beta_app_localizations(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
233 234 235 236 237 238 239 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 233 def get_beta_app_localizations(filter: {}, includes: nil, limit: nil, sort: nil) filter ||= {} filter[:app] = id resps = Spaceship::ConnectAPI.get_beta_app_localizations(filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
#get_beta_feedback(filter: {}, includes: "tester,build,screenshots", limit: nil, sort: nil) ⇒ Object
Beta Feedback
193 194 195 196 197 198 199 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 193 def get_beta_feedback(filter: {}, includes: "tester,build,screenshots", limit: nil, sort: nil) filter ||= {} filter["build.app"] = id resps = Spaceship::ConnectAPI.get_beta_feedback(filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
#get_beta_groups(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
241 242 243 244 245 246 247 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 241 def get_beta_groups(filter: {}, includes: nil, limit: nil, sort: nil) filter ||= {} filter[:app] = id resps = Spaceship::ConnectAPI.get_beta_groups(filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
#get_beta_testers(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
Beta Testers
205 206 207 208 209 210 211 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 205 def get_beta_testers(filter: {}, includes: nil, limit: nil, sort: nil) filter ||= {} filter[:apps] = id resps = Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
#get_build_deliveries(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
225 226 227 228 229 230 231 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 225 def get_build_deliveries(filter: {}, includes: nil, limit: nil, sort: nil) filter ||= {} filter[:app] = id resps = Spaceship::ConnectAPI.get_build_deliveries(filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
#get_builds(filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
Builds
217 218 219 220 221 222 223 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 217 def get_builds(filter: {}, includes: nil, limit: nil, sort: nil) filter ||= {} filter[:app] = id resps = Spaceship::ConnectAPI.get_builds(filter: filter, includes: includes, limit: limit, sort: sort).all_pages return resps.flat_map(&:to_models) end |
#get_edit_app_store_version(platform: nil, includes: nil) ⇒ Object
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 164 def get_edit_app_store_version(platform: nil, includes: nil) platform ||= Spaceship::ConnectAPI::Platform::IOS filter = { appStoreState: [ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PREPARE_FOR_SUBMISSION, Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::DEVELOPER_REJECTED, Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::REJECTED, Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::METADATA_REJECTED, Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::WAITING_FOR_REVIEW, Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::INVALID_BINARY ].join(","), platform: platform } # Get the latest version return get_app_store_versions(filter: filter, includes: includes) .sort_by { |v| Gem::Version.new(v.version_string) } .last end |
#get_live_app_store_version(platform: nil, includes: nil) ⇒ Object
155 156 157 158 159 160 161 162 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 155 def get_live_app_store_version(platform: nil, includes: nil) platform ||= Spaceship::ConnectAPI::Platform::IOS filter = { appStoreState: [Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::READY_FOR_SALE].join(","), platform: platform } return get_app_store_versions(filter: filter, includes: includes).first end |
#reject_version_if_possible! ⇒ Object
App Store Versions
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 113 def reject_version_if_possible! platform ||= Spaceship::ConnectAPI::Platform::IOS filter = { appStoreState: [ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE, Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::IN_REVIEW, Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::WAITING_FOR_REVIEW ].join(","), platform: platform } # Get the latest version version = get_app_store_versions(filter: filter, includes: "appStoreVersionSubmission") .sort_by { |v| Gem::Version.new(v.version_string) } .last return false if version.nil? return version.reject! end |
#update(attributes: nil, app_price_tier_id: nil, territory_ids: nil) ⇒ Object
73 74 75 |
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 73 def update(attributes: nil, app_price_tier_id: nil, territory_ids: nil) return Spaceship::ConnectAPI.patch_app(app_id: id, attributes: attributes, app_price_tier_id: app_price_tier_id, territory_ids: territory_ids) end |