Class: Spaceship::ConnectAPI::App

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
spaceship/lib/spaceship/connect_api/models/app.rb

Defined Under Namespace

Modules: ContentRightsDeclaration, DistributionType, EducationDiscountType

Constant Summary collapse

ESSENTIAL_INCLUDES =
[
  "appStoreVersions"
].join(",")

Instance Attribute Summary collapse

Attributes included from Model

#id, #reverse_attr_map

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model

#attr_mapping, included, #initialize, #reverse_attr_mapping, #to_json, #update_attributes

Instance Attribute Details

#app_store_versionsObject

Returns the value of attribute app_store_versions.



19
20
21
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 19

def app_store_versions
  @app_store_versions
end

#available_in_new_territoriesObject

Returns the value of attribute available_in_new_territories.



17
18
19
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 17

def available_in_new_territories
  @available_in_new_territories
end

#bundle_idObject

Returns the value of attribute bundle_id.



11
12
13
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 11

def bundle_id
  @bundle_id
end

#content_rights_declarationObject

Returns the value of attribute content_rights_declaration.



18
19
20
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 18

def content_rights_declaration
  @content_rights_declaration
end

#distribution_typeObject

Only available with Apple ID auth



23
24
25
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 23

def distribution_type
  @distribution_type
end

#educationDiscountTypeObject

Returns the value of attribute educationDiscountType.



24
25
26
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 24

def educationDiscountType
  @educationDiscountType
end

#is_aagObject

Returns the value of attribute is_aag.



16
17
18
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 16

def is_aag
  @is_aag
end

#is_opted_in_to_distribute_ios_app_on_mac_app_storeObject

Returns the value of attribute is_opted_in_to_distribute_ios_app_on_mac_app_store.



14
15
16
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 14

def is_opted_in_to_distribute_ios_app_on_mac_app_store
  @is_opted_in_to_distribute_ios_app_on_mac_app_store
end

#nameObject

Returns the value of attribute name.



10
11
12
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 10

def name
  @name
end

#pricesObject

Returns the value of attribute prices.



20
21
22
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 20

def prices
  @prices
end

#primary_localeObject

Returns the value of attribute primary_locale.



13
14
15
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 13

def primary_locale
  @primary_locale
end

#removedObject

Returns the value of attribute removed.



15
16
17
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 15

def removed
  @removed
end

#skuObject

Returns the value of attribute sku.



12
13
14
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 12

def sku
  @sku
end

Class Method Details

.all(client: nil, filter: {}, includes: ESSENTIAL_INCLUDES, limit: nil, sort: nil) ⇒ Object

Apps



73
74
75
76
77
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 73

def self.all(client: nil, filter: {}, includes: ESSENTIAL_INCLUDES, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  resps = client.get_apps(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

.create(client: nil, name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil) ⇒ Object



86
87
88
89
90
91
92
93
94
95
96
97
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 86

def self.create(client: nil, name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil)
  client ||= Spaceship::ConnectAPI
  client.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, client: nil) ⇒ Object



79
80
81
82
83
84
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 79

def self.find(bundle_id, client: nil)
  client ||= Spaceship::ConnectAPI
  return all(client: client, filter: { bundleId: bundle_id }).find do |app|
    app.bundle_id == bundle_id
  end
end

.get(client: nil, app_id: nil, includes: "appStoreVersions") ⇒ Object



99
100
101
102
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 99

def self.get(client: nil, app_id: nil, includes: "appStoreVersions")
  client ||= Spaceship::ConnectAPI
  return client.get_app(app_id: app_id, includes: includes).first
end

.typeObject



65
66
67
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 65

def self.type
  return "apps"
end

Instance Method Details

#add_users(client: nil, user_ids: nil) ⇒ Object

Users



467
468
469
470
471
472
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 467

def add_users(client: nil, user_ids: nil)
  client ||= Spaceship::ConnectAPI
  user_ids.each do |user_id|
    client.add_user_visible_apps(user_id: user_id, app_ids: [id])
  end
end

#create_beta_group(client: nil, group_name: nil, is_internal_group: false, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false, has_access_to_all_builds: nil) ⇒ Object



390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 390

def create_beta_group(client: nil, group_name: nil, is_internal_group: false, public_link_enabled: false, public_link_limit: 10_000, public_link_limit_enabled: false, has_access_to_all_builds: nil)
  client ||= Spaceship::ConnectAPI
  resps = client.create_beta_group(
    app_id: id,
    group_name: group_name,
    is_internal_group: is_internal_group,
    public_link_enabled: public_link_enabled,
    public_link_limit: public_link_limit,
    public_link_limit_enabled: public_link_limit_enabled,
    has_access_to_all_builds: has_access_to_all_builds
  ).all_pages
  return resps.flat_map(&:to_models).first
end

#create_review_submission(client: nil, platform:) ⇒ Object



457
458
459
460
461
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 457

def create_review_submission(client: nil, platform:)
  client ||= Spaceship::ConnectAPI
  resp = client.post_review_submission(app_id: id, platform: platform)
  return resp.to_models.first
end

#disable_b2bObject

B2B



311
312
313
314
315
316
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 311

def disable_b2b
  update(attributes: {
    distributionType: DistributionType::APP_STORE,
    education_discount_type: EducationDiscountType::NOT_DISCOUNTED
  })
end

#disable_educational_discountObject

Education



408
409
410
411
412
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 408

def disable_educational_discount
  update(attributes: {
    education_discount_type: EducationDiscountType::NOT_DISCOUNTED
  })
end

#enable_b2bObject



318
319
320
321
322
323
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 318

def enable_b2b
  update(attributes: {
    distributionType: App::DistributionType::CUSTOM,
    education_discount_type: EducationDiscountType::NOT_APPLICABLE
  })
end

#enable_educational_discountObject



414
415
416
417
418
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 414

def enable_educational_discount
  update(attributes: {
    education_discount_type: EducationDiscountType::DISCOUNTED
  })
end

#ensure_version!(version_string, platform: nil, client: 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

Returns:

  • (Bool)

    Was something changed?



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 207

def ensure_version!(version_string, platform: nil, client: nil)
  client ||= Spaceship::ConnectAPI
  app_store_version = get_edit_app_store_version(client: client, platform: platform)

  if app_store_version
    if version_string != app_store_version.version_string
      attributes = { versionString: version_string }
      app_store_version.update(client: client, attributes: attributes)
      return true
    end
    return false
  else
    attributes = { versionString: version_string, platform: platform }
    client.post_app_store_version(app_id: id, attributes: attributes)

    return true
  end
end

#fetch_app_prices(client: nil, filter: {}, includes: "priceTier", limit: nil, sort: nil) ⇒ Object

App Pricing



171
172
173
174
175
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 171

def fetch_app_prices(client: nil, filter: {}, includes: "priceTier", limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  resp = client.get_app_prices(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
  return resp.to_models
end

#fetch_available_territories(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

Available Territories



160
161
162
163
164
165
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 160

def fetch_available_territories(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  filter ||= {}
  resps = client.get_available_territories(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

#fetch_edit_app_info(client: nil, includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES) ⇒ Object



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 133

def fetch_edit_app_info(client: nil, includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES)
  client ||= Spaceship::ConnectAPI
  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
  ]

  resp = client.get_app_infos(app_id: id, includes: includes)
  return resp.to_models.select do |model|
    states.include?(model.app_store_state)
  end.first
end

#fetch_latest_app_info(client: nil, includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES) ⇒ Object



150
151
152
153
154
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 150

def fetch_latest_app_info(client: nil, includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES)
  client ||= Spaceship::ConnectAPI
  resp = client.get_app_infos(app_id: id, includes: includes)
  return resp.to_models.first
end

#fetch_live_app_info(client: nil, includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES) ⇒ Object

App Info



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 116

def fetch_live_app_info(client: nil, includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES)
  client ||= Spaceship::ConnectAPI
  states = [
    Spaceship::ConnectAPI::AppInfo::AppStoreState::READY_FOR_SALE,
    Spaceship::ConnectAPI::AppInfo::AppStoreState::PENDING_APPLE_RELEASE,
    Spaceship::ConnectAPI::AppInfo::AppStoreState::PENDING_DEVELOPER_RELEASE,
    Spaceship::ConnectAPI::AppInfo::AppStoreState::PROCESSING_FOR_APP_STORE,
    Spaceship::ConnectAPI::AppInfo::AppStoreState::IN_REVIEW,
    Spaceship::ConnectAPI::AppInfo::AppStoreState::DEVELOPER_REMOVED_FROM_SALE
  ]

  resp = client.get_app_infos(app_id: id, includes: includes)
  return resp.to_models.select do |model|
    states.include?(model.app_store_state)
  end.first
end

#get_app_store_versions(client: nil, filter: {}, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES, limit: nil, sort: nil) ⇒ Object



296
297
298
299
300
301
302
303
304
305
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 296

def get_app_store_versions(client: nil, filter: {}, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  if limit.nil?
    resps = client.get_app_store_versions(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
    return resps.flat_map(&:to_models)
  else
    resp = client.get_app_store_versions(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
    return resp.to_models
  end
end

#get_beta_app_localizations(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object



372
373
374
375
376
377
378
379
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 372

def get_beta_app_localizations(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  filter ||= {}
  filter[:app] = id

  resps = client.get_beta_app_localizations(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

#get_beta_feedback(client: nil, filter: {}, includes: "tester,build,screenshots", limit: nil, sort: nil) ⇒ Object

Beta Feedback



329
330
331
332
333
334
335
336
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 329

def get_beta_feedback(client: nil, filter: {}, includes: "tester,build,screenshots", limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  filter ||= {}
  filter["build.app"] = id

  resps = client.get_beta_feedback(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

#get_beta_groups(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object



381
382
383
384
385
386
387
388
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 381

def get_beta_groups(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  filter ||= {}
  filter[:app] = id

  resps = client.get_beta_groups(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

#get_beta_testers(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

Beta Testers



342
343
344
345
346
347
348
349
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 342

def get_beta_testers(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  filter ||= {}
  filter[:apps] = id

  resps = client.get_beta_testers(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

#get_build_deliveries(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object



364
365
366
367
368
369
370
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 364

def get_build_deliveries(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  filter ||= {}

  resps = client.get_build_deliveries(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

#get_builds(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

Builds



355
356
357
358
359
360
361
362
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 355

def get_builds(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  filter ||= {}
  filter[:app] = id

  resps = client.get_builds(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

#get_edit_app_store_version(client: nil, platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES) ⇒ Object



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 252

def get_edit_app_store_version(client: nil, platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES)
  client ||= Spaceship::ConnectAPI
  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(client: client, filter: filter, includes: includes)
         .sort_by { |v| Gem::Version.new(v.version_string) }
         .last
end

#get_in_progress_review_submission(client: nil, platform:, includes: nil) ⇒ Object



436
437
438
439
440
441
442
443
444
445
446
447
448
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 436

def get_in_progress_review_submission(client: nil, platform:, includes: nil)
  client ||= Spaceship::ConnectAPI
  filter = {
    state: [
      Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::WAITING_FOR_REVIEW,
      Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::IN_REVIEW,
      Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::UNRESOLVED_ISSUES
    ].join(","),
    platform: platform
  }

  return get_review_submissions(client: client, filter: filter, includes: includes).first
end

#get_in_review_app_store_version(client: nil, platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES) ⇒ Object



273
274
275
276
277
278
279
280
281
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 273

def get_in_review_app_store_version(client: nil, platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES)
  client ||= Spaceship::ConnectAPI
  platform ||= Spaceship::ConnectAPI::Platform::IOS
  filter = {
    appStoreState: Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::IN_REVIEW,
    platform: platform
  }
  return get_app_store_versions(client: client, filter: filter, includes: includes).first
end

#get_latest_app_store_version(client: nil, platform: nil, includes: nil) ⇒ Object



226
227
228
229
230
231
232
233
234
235
236
237
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 226

def get_latest_app_store_version(client: nil, platform: nil, includes: nil)
  client ||= Spaceship::ConnectAPI
  platform ||= Spaceship::ConnectAPI::Platform::IOS
  filter = {
    platform: platform
  }

  # Get the latest version
  return get_app_store_versions(client: client, filter: filter, includes: includes)
         .sort_by { |v| Date.parse(v.created_date) }
         .last
end

#get_live_app_store_version(client: nil, platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES) ⇒ Object



239
240
241
242
243
244
245
246
247
248
249
250
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 239

def get_live_app_store_version(client: nil, platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES)
  client ||= Spaceship::ConnectAPI
  platform ||= Spaceship::ConnectAPI::Platform::IOS
  filter = {
    appStoreState: [
      Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::READY_FOR_SALE,
      Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::DEVELOPER_REMOVED_FROM_SALE
    ].join(","),
    platform: platform
  }
  return get_app_store_versions(client: client, filter: filter, includes: includes).first
end

#get_pending_release_app_store_version(client: nil, platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES) ⇒ Object



283
284
285
286
287
288
289
290
291
292
293
294
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 283

def get_pending_release_app_store_version(client: nil, platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES)
  client ||= Spaceship::ConnectAPI
  platform ||= Spaceship::ConnectAPI::Platform::IOS
  filter = {
    appStoreState: [
      Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_APPLE_RELEASE,
      Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
    ].join(','),
    platform: platform
  }
  return get_app_store_versions(client: client, filter: filter, includes: includes).first
end

#get_ready_review_submission(client: nil, platform:, includes: nil) ⇒ Object

Review Submissions



424
425
426
427
428
429
430
431
432
433
434
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 424

def get_ready_review_submission(client: nil, platform:, includes: nil)
  client ||= Spaceship::ConnectAPI
  filter = {
    state: [
      Spaceship::ConnectAPI::ReviewSubmission::ReviewSubmissionState::READY_FOR_REVIEW
    ].join(","),
    platform: platform
  }

  return get_review_submissions(client: client, filter: filter, includes: includes).first
end

#get_review_submissions(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

appStoreVersionForReview,items



451
452
453
454
455
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 451

def get_review_submissions(client: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  client ||= Spaceship::ConnectAPI
  resps = client.get_review_submissions(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort).all_pages
  return resps.flat_map(&:to_models)
end

#reject_version_if_possible!(client: nil, platform: nil) ⇒ Object

App Store Versions



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 181

def reject_version_if_possible!(client: nil, platform: nil)
  client ||= Spaceship::ConnectAPI
  platform ||= Spaceship::ConnectAPI::Platform::IOS
  filter = {
    appStoreState: [
      Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_APPLE_RELEASE,
      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(client: client, filter: filter, includes: "appStoreVersionSubmission")
            .sort_by { |v| Gem::Version.new(v.version_string) }
            .last

  return false if version.nil?
  return version.reject!
end

#remove_users(client: nil, user_ids: nil) ⇒ Object



474
475
476
477
478
479
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 474

def remove_users(client: nil, user_ids: nil)
  client ||= Spaceship::ConnectAPI
  user_ids.each do |user_id|
    client.delete_user_visible_apps(user_id: user_id, app_ids: [id])
  end
end

#update(client: nil, attributes: nil, app_price_tier_id: nil, territory_ids: nil, allow_removing_from_sale: false) ⇒ Object

Updates app attributes, price tier and availability of an app in territories Check Tunes patch_app method for explanation how to use territory_ids parameter with allow_removing_from_sale to remove app from sale



106
107
108
109
110
# File 'spaceship/lib/spaceship/connect_api/models/app.rb', line 106

def update(client: nil, attributes: nil, app_price_tier_id: nil, territory_ids: nil, allow_removing_from_sale: false)
  client ||= Spaceship::ConnectAPI
  attributes = reverse_attr_mapping(attributes)
  return client.patch_app(app_id: id, attributes: attributes, app_price_tier_id: app_price_tier_id, territory_ids: territory_ids, allow_removing_from_sale: allow_removing_from_sale)
end