Module: Spaceship::ConnectAPI::Tunes

Included in:
Spaceship::ConnectAPI
Defined in:
spaceship/lib/spaceship/connect_api/tunes/tunes.rb,
spaceship/lib/spaceship/connect_api/tunes/client.rb

Defined Under Namespace

Classes: Client

Instance Method Summary collapse

Instance Method Details

#delete_app_info(app_info_id: nil) ⇒ Object


508
509
510
511
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 508

def delete_app_info(app_info_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("appInfos/#{app_info_id}", params)
end

#delete_app_preview(app_preview_id: nil) ⇒ Object


230
231
232
233
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 230

def delete_app_preview(app_preview_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("appPreviews/#{app_preview_id}", params)
end

#delete_app_review_attachment(app_review_attachment_id: nil) ⇒ Object


307
308
309
310
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 307

def delete_app_review_attachment(app_review_attachment_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("appReviewAttachments/#{app_review_attachment_id}", params)
end

#delete_app_screenshot(app_screenshot_id: nil) ⇒ Object


400
401
402
403
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 400

def delete_app_screenshot(app_screenshot_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("appScreenshots/#{app_screenshot_id}", params)
end

#delete_app_store_version_localization(app_store_version_localization_id: nil) ⇒ Object


633
634
635
636
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 633

def delete_app_store_version_localization(app_store_version_localization_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("appStoreVersionLocalizations/#{app_store_version_localization_id}", params)
end

#delete_app_store_version_phased_release(app_store_version_phased_release_id: nil) ⇒ Object


666
667
668
669
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 666

def delete_app_store_version_phased_release(app_store_version_phased_release_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("appStoreVersionPhasedReleases/#{app_store_version_phased_release_id}", params)
end

#delete_app_store_version_submission(app_store_version_submission_id: nil) ⇒ Object


799
800
801
802
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 799

def delete_app_store_version_submission(app_store_version_submission_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("appStoreVersionSubmissions/#{app_store_version_submission_id}", params)
end

#delete_idfa_declaration(idfa_declaration_id: nil) ⇒ Object


844
845
846
847
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 844

def delete_idfa_declaration(idfa_declaration_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("idfaDeclarations/#{idfa_declaration_id}", params)
end

#delete_reset_ratings_request(reset_ratings_request_id: nil) ⇒ Object


767
768
769
770
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 767

def delete_reset_ratings_request(reset_ratings_request_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.delete("resetRatingsRequests/#{reset_ratings_request_id}", params)
end

#get_age_rating_declaration(app_store_version_id: nil) ⇒ Object

ageRatingDeclarations


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

def get_age_rating_declaration(app_store_version_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.get("appStoreVersions/#{app_store_version_id}/ageRatingDeclaration", params)
end

#get_app_info_localizations(app_info_id: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

appInfoLocalizations


517
518
519
520
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 517

def get_app_info_localizations(app_info_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("appInfos/#{app_info_id}/appInfoLocalizations", params)
end

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

appInfos


409
410
411
412
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 409

def get_app_infos(filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("appInfos", params)
end

#get_app_preview(app_preview_id: nil) ⇒ Object

appPreview


194
195
196
197
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 194

def get_app_preview(app_preview_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.get("appPreviews/#{app_preview_id}", params)
end

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

appPreviewSets


239
240
241
242
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 239

def get_app_preview_sets(filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("appPreviewSets", params)
end

#get_app_prices(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

appPrices


267
268
269
270
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 267

def get_app_prices(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("appPrices", params)
end

#get_app_screenshot(app_screenshot_id: nil) ⇒ Object

appScreenshots


364
365
366
367
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 364

def get_app_screenshot(app_screenshot_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.get("appScreenshots/#{app_screenshot_id}", params)
end

#get_app_screenshot_set(app_screenshot_set_id: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object


321
322
323
324
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 321

def get_app_screenshot_set(app_screenshot_set_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("appScreenshotSets/#{app_screenshot_set_id}", params)
end

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

appScreenshotSets


316
317
318
319
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 316

def get_app_screenshot_sets(filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("appScreenshotSets", params)
end

#get_app_store_review_detail(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

appStoreReviewDetails


557
558
559
560
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 557

def get_app_store_review_detail(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreReviewDetail", params)
end

#get_app_store_version(app_store_version_id: nil, includes: nil) ⇒ Object


680
681
682
683
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 680

def get_app_store_version(app_store_version_id: nil, includes: nil)
  params = Client.instance.build_params(filter: nil, includes: includes, limit: nil, sort: nil)
  Client.instance.get("appStoreVersions/#{app_store_version_id}", params)
end

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

appStoreVersionLocalizations


597
598
599
600
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 597

def get_app_store_version_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("appStoreVersionLocalizations", params)
end

#get_app_store_version_phased_release(app_store_version_id: nil) ⇒ Object

appStoreVersionPhasedReleases


642
643
644
645
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 642

def get_app_store_version_phased_release(app_store_version_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreVersionPhasedRelease", params)
end

#get_app_store_version_submission(app_store_version_id: nil) ⇒ Object

appStoreVersionSubmissions


776
777
778
779
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 776

def get_app_store_version_submission(app_store_version_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.get("appStoreVersions/#{app_store_version_id}/appStoreVersionSubmission", params)
end

#get_app_store_versions(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object

appStoreVersions


675
676
677
678
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 675

def get_app_store_versions(app_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: filter, includes: includes, limit: limit, sort: sort)
  Client.instance.get("apps/#{app_id}/appStoreVersions", params)
end

#get_idfa_declaration(app_store_version_id: nil) ⇒ Object

idfaDeclarations


808
809
810
811
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 808

def get_idfa_declaration(app_store_version_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.get("appStoreVersions/#{app_store_version_id}/idfaDeclaration", params)
end

#get_reset_ratings_request(app_store_version_id: nil) ⇒ Object

appStoreVersionPhasedReleases


744
745
746
747
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 744

def get_reset_ratings_request(app_store_version_id: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.get("appStoreVersions/#{app_store_version_id}/resetRatingsRequest", params)
end

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

territories


853
854
855
856
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 853

def get_territories(filter: {}, includes: nil, limit: nil, sort: nil)
  params = Client.instance.build_params(filter: nil, includes: nil, limit: nil, sort: nil)
  Client.instance.get("territories", params)
end

#patch_age_rating_declaration(age_rating_declaration_id: nil, attributes: nil) ⇒ Object


15
16
17
18
19
20
21
22
23
24
25
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 15

def patch_age_rating_declaration(age_rating_declaration_id: nil, attributes: nil)
  body = {
    data: {
      type: "ageRatingDeclarations",
      id: age_rating_declaration_id,
      attributes: attributes
    }
  }

  Client.instance.patch("ageRatingDeclarations/#{age_rating_declaration_id}", body)
end

#patch_app(app_id: nil, attributes: {}, app_price_tier_id: nil, territory_ids: nil) ⇒ Object


125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 125

def patch_app(app_id: nil, attributes: {}, app_price_tier_id: nil, territory_ids: nil)
  relationships = {}
  included = []

  # Price tier
  unless app_price_tier_id.nil?
    relationships[:prices] = {
      data: [
        {
          type: "appPrices",
          id: "${price1}"
        }
      ]
    }

    included << {
      type: "appPrices",
      id: "${price1}",
      attributes: {
        startDate: nil
      },
      relationships: {
        app: {
          data: {
            type: "apps",
            id: app_id
          }
        },
        priceTier: {
          data: {
            type: "appPriceTiers",
            id: app_price_tier_id.to_s
          }
        }
      }
    }
  end

  # Territories
  territories_data = (territory_ids || []).map do |id|
    { type: "territories", id: id }
  end
  unless territories_data.empty?
    relationships[:availableTerritories] = {
      data: territories_data
    }
  end

  # Data
  data = {
    type: "apps",
    id: app_id
  }
  data[:attributes] = attributes unless attributes.empty?
  data[:relationships] = relationships unless relationships.empty?

  # Body
  body = {
    data: data
  }
  body[:included] = included unless included.empty?

  Client.instance.patch("apps/#{app_id}", body)
end

#patch_app_info(app_info_id: nil, attributes: {}) ⇒ Object


414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 414

def patch_app_info(app_info_id: nil, attributes: {})
  attributes ||= {}

  data = {
    type: "appInfos",
    id: app_info_id
  }
  data[:attributes] = attributes unless attributes.empty?

  body = {
    data: data
  }

  Client.instance.patch("appInfos/#{app_info_id}", body)
end

#patch_app_info_categories(app_info_id: nil, category_id_map: nil) ⇒ Object

Adding the key will create/update (if value) or delete if nil Not including a key will leave as is category_id_map:

primary_category_id: "GAMES",
primary_subcategory_one_id: "PUZZLE",
primary_subcategory_two_id: "STRATEGY",
secondary_category_id: nil,
secondary_subcategory_one_id: nil,
secondary_subcategory_two_id: nil


442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 442

def patch_app_info_categories(app_info_id: nil, category_id_map: nil)
  category_id_map ||= {}
  primary_category_id = category_id_map[:primary_category_id]
  primary_subcategory_one_id = category_id_map[:primary_subcategory_one_id]
  primary_subcategory_two_id = category_id_map[:primary_subcategory_two_id]
  secondary_category_id = category_id_map[:secondary_category_id]
  secondary_subcategory_one_id = category_id_map[:secondary_subcategory_one_id]
  secondary_subcategory_two_id = category_id_map[:secondary_subcategory_two_id]

  relationships = {}

  # Only update if key is included (otherwise category will be removed)
  if category_id_map.include?(:primary_category_id)
    relationships[:primaryCategory] = {
      data: primary_category_id ? { type: "appCategories", id: primary_category_id } : nil
    }
  end

  # Only update if key is included (otherwise category will be removed)
  if category_id_map.include?(:primary_subcategory_one_id)
    relationships[:primarySubcategoryOne] = {
      data: primary_subcategory_one_id ? { type: "appCategories", id: primary_subcategory_one_id } : nil
    }
  end

  # Only update if key is included (otherwise category will be removed)
  if category_id_map.include?(:primary_subcategory_two_id)
    relationships[:primarySubcategoryTwo] = {
      data: primary_subcategory_two_id ? { type: "appCategories", id: primary_subcategory_two_id } : nil
    }
  end

  # Only update if key is included (otherwise category will be removed)
  if category_id_map.include?(:secondary_category_id)
    relationships[:secondaryCategory] = {
      data: secondary_category_id ? { type: "appCategories", id: secondary_category_id } : nil
    }
  end

  # Only update if key is included (otherwise category will be removed)
  if category_id_map.include?(:secondary_subcategory_one_id)
    relationships[:secondarySubcategoryOne] = {
      data: secondary_subcategory_one_id ? { type: "appCategories", id: secondary_subcategory_one_id } : nil
    }
  end

  # Only update if key is included (otherwise category will be removed)
  if category_id_map.include?(:secondary_subcategory_two_id)
    relationships[:secondarySubcategoryTwo] = {
      data: secondary_subcategory_two_id ? { type: "appCategories", id: secondary_subcategory_two_id } : nil
    }
  end

  data = {
    type: "appInfos",
    id: app_info_id
  }
  data[:relationships] = relationships unless relationships.empty?

  body = {
    data: data
  }

  Client.instance.patch("appInfos/#{app_info_id}", body)
end

#patch_app_info_localization(app_info_localization_id: nil, attributes: {}) ⇒ Object


541
542
543
544
545
546
547
548
549
550
551
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 541

def patch_app_info_localization(app_info_localization_id: nil, attributes: {})
  body = {
    data: {
      type: "appInfoLocalizations",
      id: app_info_localization_id,
      attributes: attributes
    }
  }

  Client.instance.patch("appInfoLocalizations/#{app_info_localization_id}", body)
end

#patch_app_preview(app_preview_id: nil, attributes: {}) ⇒ Object


218
219
220
221
222
223
224
225
226
227
228
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 218

def patch_app_preview(app_preview_id: nil, attributes: {})
  body = {
    data: {
      type: "appPreviews",
      id: app_preview_id,
      attributes: attributes
    }
  }

  Client.instance.patch("appPreviews/#{app_preview_id}", body)
end

#patch_app_review_attachment(app_review_attachment_id: nil, attributes: {}) ⇒ Object


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

def patch_app_review_attachment(app_review_attachment_id: nil, attributes: {})
  body = {
    data: {
      type: "appReviewAttachments",
      id: app_review_attachment_id,
      attributes: attributes
    }
  }

  Client.instance.patch("appReviewAttachments/#{app_review_attachment_id}", body)
end

#patch_app_screenshot(app_screenshot_id: nil, attributes: {}) ⇒ Object


388
389
390
391
392
393
394
395
396
397
398
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 388

def patch_app_screenshot(app_screenshot_id: nil, attributes: {})
  body = {
    data: {
      type: "appScreenshots",
      id: app_screenshot_id,
      attributes: attributes
    }
  }

  Client.instance.patch("appScreenshots/#{app_screenshot_id}", body)
end

#patch_app_screenshot_set_screenshots(app_screenshot_set_id: nil, app_screenshot_ids: nil) ⇒ Object


345
346
347
348
349
350
351
352
353
354
355
356
357
358
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 345

def patch_app_screenshot_set_screenshots(app_screenshot_set_id: nil, app_screenshot_ids: nil)
  app_screenshot_ids ||= []

  body = {
    data: app_screenshot_ids.map do |app_screenshot_id|
      {
        type: "appScreenshots",
        id: app_screenshot_id
      }
    end
  }

  Client.instance.patch("appScreenshotSets/#{app_screenshot_set_id}/relationships/appScreenshots", body)
end

#patch_app_store_review_detail(app_store_review_detail_id: nil, attributes: {}) ⇒ Object


581
582
583
584
585
586
587
588
589
590
591
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 581

def patch_app_store_review_detail(app_store_review_detail_id: nil, attributes: {})
  body = {
    data: {
      type: "appStoreReviewDetails",
      id: app_store_review_detail_id,
      attributes: attributes
    }
  }

  Client.instance.patch("appStoreReviewDetails/#{app_store_review_detail_id}", body)
end

#patch_app_store_version(app_store_version_id: nil, attributes: {}) ⇒ Object


704
705
706
707
708
709
710
711
712
713
714
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 704

def patch_app_store_version(app_store_version_id: nil, attributes: {})
  body = {
    data: {
      type: "appStoreVersions",
      id: app_store_version_id,
      attributes: attributes
    }
  }

  Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
end

#patch_app_store_version_localization(app_store_version_localization_id: nil, attributes: {}) ⇒ Object


621
622
623
624
625
626
627
628
629
630
631
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 621

def patch_app_store_version_localization(app_store_version_localization_id: nil, attributes: {})
  body = {
    data: {
      type: "appStoreVersionLocalizations",
      id: app_store_version_localization_id,
      attributes: attributes
    }
  }

  Client.instance.patch("appStoreVersionLocalizations/#{app_store_version_localization_id}", body)
end

#patch_app_store_version_with_build(app_store_version_id: nil, build_id: nil) ⇒ Object


716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 716

def patch_app_store_version_with_build(app_store_version_id: nil, build_id: nil)
  data = nil
  if build_id
    data = {
      type: "builds",
      id: build_id
    }
  end

  body = {
    data: {
      type: "appStoreVersions",
      id: app_store_version_id,
      relationships: {
        build: {
          data: data
        }
      }
    }
  }

  Client.instance.patch("appStoreVersions/#{app_store_version_id}", body)
end

#patch_idfa_declaration(idfa_declaration_id: nil, attributes: nil) ⇒ Object


832
833
834
835
836
837
838
839
840
841
842
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 832

def patch_idfa_declaration(idfa_declaration_id: nil, attributes: nil)
  body = {
    data: {
      type: "idfaDeclarations",
      id: idfa_declaration_id,
      attributes: attributes
    }
  }

  Client.instance.patch("idfaDeclarations/#{idfa_declaration_id}", body)
end

#post_app(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil) ⇒ Object

app


31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 31

def post_app(name: nil, version_string: nil, sku: nil, primary_locale: nil, bundle_id: nil, platforms: nil, company_name: nil)
  included = []
  included << {
    type: "appInfos",
    id: "${new-appInfo-id}",
    relationships: {
      appInfoLocalizations: {
        data: [
          {
            type: "appInfoLocalizations",
            id: "${new-appInfoLocalization-id}"
          }
        ]
      }
    }
  }
  included << {
    type: "appInfoLocalizations",
    id: "${new-appInfoLocalization-id}",
    attributes: {
      locale: primary_locale,
      name: name
    }
  }

  platforms.each do |platform|
    included << {
      type: "appStoreVersions",
      id: "${store-version-#{platform}}",
      attributes: {
        platform: platform,
        versionString: version_string
      },
      relationships: {
        appStoreVersionLocalizations: {
          data: [
            {
              type: "appStoreVersionLocalizations",
              id: "${new-#{platform}VersionLocalization-id}"
            }
          ]
        }
      }
    }

    included << {
      type: "appStoreVersionLocalizations",
      id: "${new-#{platform}VersionLocalization-id}",
      attributes: {
        locale: primary_locale
      }
    }
  end

  app_store_verions_data = platforms.map do |platform|
    {
      type: "appStoreVersions",
      id: "${store-version-#{platform}}"
    }
  end

  relationships = {
    appStoreVersions: {
      data: app_store_verions_data
    },
    appInfos: {
      data: [
        {
          type: "appInfos",
          id: "${new-appInfo-id}"
        }
      ]
    }
  }

  app_attributes = {
    sku: sku,
    primaryLocale: primary_locale,
    bundleId: bundle_id
  }
  app_attributes[:companyName] = company_name if company_name

  body = {
    data: {
      type: "apps",
      attributes: app_attributes,
      relationships: relationships
    },
    included: included
  }

  Client.instance.post("apps", body)
end

#post_app_info_localization(app_info_id: nil, attributes: {}) ⇒ Object


522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 522

def post_app_info_localization(app_info_id: nil, attributes: {})
  body = {
    data: {
      type: "appInfoLocalizations",
      attributes: attributes,
      relationships: {
        appStoreVersion: {
          data: {
            type: "appStoreVersions",
            id: app_info_id
          }
        }
      }
    }
  }

  Client.instance.post("appInfoLocalizations", body)
end

#post_app_preview(app_preview_set_id: nil, attributes: {}) ⇒ Object


199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 199

def post_app_preview(app_preview_set_id: nil, attributes: {})
  body = {
    data: {
      type: "appPreviews",
      attributes: attributes,
      relationships: {
        appPreviewSet: {
          data: {
            type: "appPreviewSets",
            id: app_preview_set_id
          }
        }
      }
    }
  }

  Client.instance.post("appPreviews", body)
end

#post_app_preview_set(app_store_version_localization_id: nil, attributes: {}) ⇒ Object


244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 244

def post_app_preview_set(app_store_version_localization_id: nil, attributes: {})
  body = {
    data: {
      type: "appPreviewSets",
      attributes: attributes,
      relationships: {
        appStoreVersionLocalization: {
          data: {
            type: "appStoreVersionLocalizations",
            id: app_store_version_localization_id
          }
        }
      }
    }
  }

  Client.instance.post("appPreviewSets", body)
end

#post_app_review_attachment(app_store_review_detail_id: nil, attributes: {}) ⇒ Object

appReviewAttachments


276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 276

def post_app_review_attachment(app_store_review_detail_id: nil, attributes: {})
  body = {
    data: {
      type: "appReviewAttachments",
      attributes: attributes,
      relationships: {
        appStoreReviewDetail: {
          data: {
            type: "appStoreReviewDetails",
            id: app_store_review_detail_id
          }
        }
      }
    }
  }

  Client.instance.post("appReviewAttachments", body)
end

#post_app_screenshot(app_screenshot_set_id: nil, attributes: {}) ⇒ Object


369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 369

def post_app_screenshot(app_screenshot_set_id: nil, attributes: {})
  body = {
    data: {
      type: "appScreenshots",
      attributes: attributes,
      relationships: {
        appScreenshotSet: {
          data: {
            type: "appScreenshotSets",
            id: app_screenshot_set_id
          }
        }
      }
    }
  }

  Client.instance.post("appScreenshots", body)
end

#post_app_screenshot_set(app_store_version_localization_id: nil, attributes: {}) ⇒ Object


326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 326

def post_app_screenshot_set(app_store_version_localization_id: nil, attributes: {})
  body = {
    data: {
      type: "appScreenshotSets",
      attributes: attributes,
      relationships: {
        appStoreVersionLocalization: {
          data: {
            type: "appStoreVersionLocalizations",
            id: app_store_version_localization_id
          }
        }
      }
    }
  }

  Client.instance.post("appScreenshotSets", body)
end

#post_app_store_review_detail(app_store_version_id: nil, attributes: {}) ⇒ Object


562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 562

def post_app_store_review_detail(app_store_version_id: nil, attributes: {})
  body = {
    data: {
      type: "appStoreReviewDetails",
      attributes: attributes,
      relationships: {
        appStoreVersion: {
          data: {
            type: "appStoreVersions",
            id: app_store_version_id
          }
        }
      }
    }
  }

  Client.instance.post("appStoreReviewDetails", body)
end

#post_app_store_version(app_id: nil, attributes: {}) ⇒ Object


685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 685

def post_app_store_version(app_id: nil, attributes: {})
  body = {
    data: {
      type: "appStoreVersions",
      attributes: attributes,
      relationships: {
        app: {
          data: {
            type: "apps",
            id: app_id
          }
        }
      }
    }
  }

  Client.instance.post("appStoreVersions", body)
end

#post_app_store_version_localization(app_store_version_id: nil, attributes: {}) ⇒ Object


602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 602

def post_app_store_version_localization(app_store_version_id: nil, attributes: {})
  body = {
    data: {
      type: "appStoreVersionLocalizations",
      attributes: attributes,
      relationships: {
        appStoreVersion: {
          data: {
            type: "appStoreVersions",
            id: app_store_version_id
          }
        }
      }
    }
  }

  Client.instance.post("appStoreVersionLocalizations", body)
end

#post_app_store_version_phased_release(app_store_version_id: nil, attributes: {}) ⇒ Object


647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 647

def post_app_store_version_phased_release(app_store_version_id: nil, attributes: {})
  body = {
    data: {
      type: "appStoreVersionPhasedReleases",
      attributes: attributes,
      relationships: {
        appStoreVersion: {
          data: {
            type: "appStoreVersions",
            id: app_store_version_id
          }
        }
      }
    }
  }

  Client.instance.post("appStoreVersionPhasedReleases", body)
end

#post_app_store_version_submission(app_store_version_id: nil) ⇒ Object


781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 781

def post_app_store_version_submission(app_store_version_id: nil)
  body = {
    data: {
      type: "appStoreVersionSubmissions",
      relationships: {
        appStoreVersion: {
          data: {
            type: "appStoreVersions",
            id: app_store_version_id
          }
        }
      }
    }
  }

  Client.instance.post("appStoreVersionSubmissions", body)
end

#post_idfa_declaration(app_store_version_id: nil, attributes: nil) ⇒ Object


813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 813

def post_idfa_declaration(app_store_version_id: nil, attributes: nil)
  body = {
    data: {
      type: "idfaDeclarations",
      attributes: attributes,
      relationships: {
        appStoreVersion: {
          data: {
            type: "appStoreVersions",
            id: app_store_version_id
          }
        }
      }
    }
  }

  Client.instance.post("idfaDeclarations", body)
end

#post_reset_ratings_request(app_store_version_id: nil) ⇒ Object


749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
# File 'spaceship/lib/spaceship/connect_api/tunes/tunes.rb', line 749

def post_reset_ratings_request(app_store_version_id: nil)
  body = {
    data: {
      type: "resetRatingsRequests",
      relationships: {
        appStoreVersion: {
          data: {
            type: "appStoreVersions",
            id: app_store_version_id
          }
        }
      }
    }
  }

  Client.instance.post("resetRatingsRequests", body)
end