Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[spaceship] implement resolution center API in Spaceship::ConnectAPI (#…
…20726) * Get resolution center threads * Add models for resolution messages and rejections * Add resolution center calls to tunes client * fix rubocop findings * Add ability to get resolution center messages from ReviewSubmission (#1) * Fix list issues * Added comment about only available with Apple ID auth Co-authored-by: Addison Brickey <addbrick@gmail.com> Co-authored-by: Josh Holtz <me@joshholtz.com>
- Loading branch information
1 parent
4b30089
commit 2263403
Showing
7 changed files
with
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require_relative '../model' | ||
module Spaceship | ||
class ConnectAPI | ||
class Actor | ||
include Spaceship::ConnectAPI::Model | ||
|
||
attr_accessor :actor_type | ||
attr_accessor :user_first_name | ||
attr_accessor :user_last_name | ||
attr_accessor :user_email | ||
attr_accessor :api_key_id | ||
|
||
attr_mapping({ | ||
actorType: 'actor_type', | ||
userFirstName: 'user_first_name', | ||
userLastName: 'user_last_name', | ||
userEmail: 'user_email', | ||
apiKeyId: 'api_key_id' | ||
}) | ||
|
||
def self.type | ||
return 'actors' | ||
end | ||
end | ||
end | ||
end |
29 changes: 29 additions & 0 deletions
29
spaceship/lib/spaceship/connect_api/models/resolution_center_message.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,29 @@ | ||
require_relative '../model' | ||
require_relative './actor' | ||
require_relative './review_rejection' | ||
|
||
module Spaceship | ||
class ConnectAPI | ||
class ResolutionCenterMessage | ||
include Spaceship::ConnectAPI::Model | ||
|
||
attr_accessor :message_body | ||
attr_accessor :created_date | ||
attr_accessor :rejections | ||
attr_accessor :from_actor | ||
|
||
attr_mapping({ | ||
messageBody: 'message_body', | ||
createdDate: 'created_date', | ||
|
||
# includes | ||
rejections: 'rejections', | ||
fromActor: 'from_actor' | ||
}) | ||
|
||
def self.type | ||
return 'resolutionCenterMessages' | ||
end | ||
end | ||
end | ||
end |
67 changes: 67 additions & 0 deletions
67
spaceship/lib/spaceship/connect_api/models/resolution_center_thread.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,67 @@ | ||
require_relative '../model' | ||
|
||
module Spaceship | ||
class ConnectAPI | ||
class ResolutionCenterThread | ||
include Spaceship::ConnectAPI::Model | ||
|
||
attr_accessor :state | ||
attr_accessor :can_developer_add_node | ||
attr_accessor :objectionable_content | ||
attr_accessor :thread_type | ||
attr_accessor :created_date | ||
attr_accessor :last_message_response_date | ||
|
||
attr_accessor :resolution_center_messages | ||
attr_accessor :app_store_version | ||
|
||
module ThreadType | ||
REJECTION_BINARY = 'REJECTION_BINARY' | ||
REJECTION_METADATA = 'REJECTION_METADATA' | ||
REJECTION_REVIEW_SUBMISSION = 'REJECTION_REVIEW_SUBMISSION' | ||
APP_MESSAGE_ARC = 'APP_MESSAGE_ARC' | ||
APP_MESSAGE_ARB = 'APP_MESSAGE_ARB' | ||
APP_MESSAGE_COMM = 'APP_MESSAGE_COMM' | ||
end | ||
|
||
attr_mapping({ | ||
state: 'state', | ||
canDeveloperAddNote: 'can_developer_add_node', | ||
objectionableContent: 'objectionable_content', | ||
threadType: 'thread_type', | ||
createdDate: 'created_date', | ||
lastMessageResponseDate: 'last_message_response_date', | ||
|
||
# includes | ||
resolutionCenterMessages: 'resolution_center_messages', | ||
appStoreVersion: 'app_store_version' | ||
}) | ||
|
||
def self.type | ||
return "resolutionCenterThreads" | ||
end | ||
|
||
# | ||
# API | ||
# | ||
|
||
def self.all(client: nil, filter:, includes: nil) | ||
client ||= Spaceship::ConnectAPI | ||
resps = client.get_resolution_center_threads(filter: filter, includes: includes).all_pages | ||
return resps.flat_map(&:to_models) | ||
end | ||
|
||
def fetch_messages(client: nil, filter: {}, includes: nil) | ||
client ||= Spaceship::ConnectAPI | ||
resps = client.get_resolution_center_messages(thread_id: id, filter: filter, includes: includes).all_pages | ||
return resps.flat_map(&:to_models) | ||
end | ||
|
||
def fetch_rejection_reasons(client: nil, includes: nil) | ||
client ||= Spaceship::ConnectAPI | ||
resp = client.get_review_rejection(filter: { 'resolutionCenterMessage.resolutionCenterThread': id }, includes: includes) | ||
return resp.to_models | ||
end | ||
end | ||
end | ||
end |
19 changes: 19 additions & 0 deletions
19
spaceship/lib/spaceship/connect_api/models/review_rejection.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,19 @@ | ||
require_relative '../model' | ||
|
||
module Spaceship | ||
class ConnectAPI | ||
class ReviewRejection | ||
include Spaceship::ConnectAPI::Model | ||
|
||
attr_accessor :reasons | ||
|
||
attr_mapping({ | ||
reasons: 'reasons' | ||
}) | ||
|
||
def self.type | ||
return 'reviewRejections' | ||
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
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