-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[spaceship] Initial support for updated review submissions flow (#19751)
* feat: add support for review submissions and review submission items * test: tunes client, review submission and review submission tests * feat: add new app store version value ready for review * chore: disable class length warning on app model * chore: make submission parameters required
- Loading branch information
1 parent
576e76b
commit 5931981
Showing
18 changed files
with
1,108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
spaceship/lib/spaceship/connect_api/models/review_submission.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
require_relative '../model' | ||
require_relative './review_submission_item' | ||
|
||
module Spaceship | ||
class ConnectAPI | ||
class ReviewSubmission | ||
include Spaceship::ConnectAPI::Model | ||
|
||
attr_accessor :platform | ||
attr_accessor :state | ||
attr_accessor :submitted_date | ||
|
||
attr_accessor :app_store_version_for_review | ||
attr_accessor :items | ||
attr_accessor :last_updated_by_actor | ||
attr_accessor :submitted_by_actor | ||
|
||
module ReviewSubmissionState | ||
CANCELING = "CANCELING" | ||
COMPLETE = "COMPLETE" | ||
IN_REVIEW = "IN_REVIEW" | ||
READY_FOR_REVIEW = "READY_FOR_REVIEW" | ||
WAITING_FOR_REVIEW = "WAITING_FOR_REVIEW" | ||
end | ||
|
||
attr_mapping({ | ||
"platform" => "platform", | ||
"state" => "state", | ||
"submittedDate" => "submitted_date", | ||
|
||
"appStoreVersionForReview" => "app_store_version_for_review", | ||
"items" => "items", | ||
"lastUpdatedByActor" => "last_updated_by_actor", | ||
"submittedByActor" => "submitted_by_actor", | ||
}) | ||
|
||
def self.type | ||
return "reviewSubmissions" | ||
end | ||
|
||
# | ||
# API | ||
# | ||
|
||
# appStoreVersionForReview,items,submittedByActor,lastUpdatedByActor | ||
def self.get(client: nil, review_submission_id:, includes: nil) | ||
client ||= Spaceship::ConnectAPI | ||
resp = client.get_review_submission(review_submission_id: review_submission_id, includes: includes) | ||
return resp.to_models.first | ||
end | ||
|
||
def submit_for_review(client: nil) | ||
client ||= Spaceship::ConnectAPI | ||
attributes = { submitted: true } | ||
resp = client.patch_review_submission(review_submission_id: id, attributes: attributes) | ||
return resp.to_models.first | ||
end | ||
|
||
def cancel_submission(client: nil) | ||
client ||= Spaceship::ConnectAPI | ||
attributes = { canceled: true } | ||
resp = client.patch_review_submission(review_submission_id: id, attributes: attributes) | ||
return resp.to_models.first | ||
end | ||
|
||
def add_app_store_version_to_review_items(client: nil, app_store_version_id:) | ||
client ||= Spaceship::ConnectAPI | ||
resp = client.post_review_submission_item(review_submission_id: id, app_store_version_id: app_store_version_id) | ||
return resp.to_models.first | ||
end | ||
end | ||
end | ||
end |
40 changes: 40 additions & 0 deletions
40
spaceship/lib/spaceship/connect_api/models/review_submission_item.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require_relative '../model' | ||
|
||
module Spaceship | ||
class ConnectAPI | ||
class ReviewSubmissionItem | ||
include Spaceship::ConnectAPI::Model | ||
|
||
attr_accessor :state | ||
|
||
attr_accessor :app_store_version_experiment | ||
attr_accessor :app_store_version | ||
attr_accessor :app_store_product_page_version | ||
attr_accessor :app_event | ||
|
||
attr_mapping({ | ||
"state" => "state", | ||
|
||
"appStoreVersionExperiment" => "app_store_version_experiment", | ||
"appStoreVersion" => "app_store_version", | ||
"appCustomProductPageVersion" => "app_store_product_page_version", | ||
"appEvent" => "app_event", | ||
}) | ||
|
||
def self.type | ||
return "reviewSubmissionItems" | ||
end | ||
|
||
# | ||
# API | ||
# | ||
|
||
# appCustomProductPageVersion,appEvent,appStoreVersion,appStoreVersionExperiment | ||
def self.all(client: nil, review_submission_id:, includes: nil, limit: nil, sort: nil) | ||
client ||= Spaceship::ConnectAPI | ||
resps = client.get_review_submission_items(review_submission_id: review_submission_id, includes: includes, limit: limit, sort: sort).all_pages | ||
return resps.flat_map(&:to_models) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.