Class: Spaceship::ConnectAPI::AppPreviewSet
- Inherits:
-
Object
- Object
- Spaceship::ConnectAPI::AppPreviewSet
- Includes:
- Model
- Defined in:
- spaceship/lib/spaceship/connect_api/models/app_preview_set.rb
Defined Under Namespace
Modules: PreviewType
Instance Attribute Summary collapse
-
#app_previews ⇒ Object
Returns the value of attribute app_previews.
-
#preview_type ⇒ Object
Returns the value of attribute preview_type.
Attributes included from Model
Class Method Summary collapse
-
.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
API.
- .get(client: nil, app_preview_set_id: nil, includes: "appPreviews") ⇒ Object
- .type ⇒ Object
Instance Method Summary collapse
- #delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
- #reorder_previews(client: nil, app_preview_ids: nil) ⇒ Object
- #upload_preview(client: nil, path: nil, wait_for_processing: true, position: nil, frame_time_code: nil) ⇒ Object
Methods included from Model
#attr_mapping, included, #initialize, #reverse_attr_mapping, #to_json, #update_attributes
Instance Attribute Details
#app_previews ⇒ Object
Returns the value of attribute app_previews.
11 12 13 |
# File 'spaceship/lib/spaceship/connect_api/models/app_preview_set.rb', line 11 def app_previews @app_previews end |
#preview_type ⇒ Object
Returns the value of attribute preview_type.
9 10 11 |
# File 'spaceship/lib/spaceship/connect_api/models/app_preview_set.rb', line 9 def preview_type @preview_type end |
Class Method Details
.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
API
63 64 65 66 67 |
# File 'spaceship/lib/spaceship/connect_api/models/app_preview_set.rb', line 63 def self.all(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) client ||= Spaceship::ConnectAPI resp = client.get_app_preview_sets(filter: filter, includes: includes, limit: limit, sort: sort) return resp.to_models end |
.get(client: nil, app_preview_set_id: nil, includes: "appPreviews") ⇒ Object
69 70 71 72 |
# File 'spaceship/lib/spaceship/connect_api/models/app_preview_set.rb', line 69 def self.get(client: nil, app_preview_set_id: nil, includes: "appPreviews") client ||= Spaceship::ConnectAPI return client.get_app_preview_set(app_preview_set_id: app_preview_set_id, filter: nil, includes: includes, limit: nil, sort: nil).first end |
.type ⇒ Object
55 56 57 |
# File 'spaceship/lib/spaceship/connect_api/models/app_preview_set.rb', line 55 def self.type return "appPreviewSets" end |
Instance Method Details
#delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) ⇒ Object
74 75 76 77 |
# File 'spaceship/lib/spaceship/connect_api/models/app_preview_set.rb', line 74 def delete!(client: nil, filter: {}, includes: nil, limit: nil, sort: nil) client ||= Spaceship::ConnectAPI return client.delete_app_preview_set(app_preview_set_id: id) end |
#reorder_previews(client: nil, app_preview_ids: nil) ⇒ Object
103 104 105 106 107 108 |
# File 'spaceship/lib/spaceship/connect_api/models/app_preview_set.rb', line 103 def reorder_previews(client: nil, app_preview_ids: nil) client ||= Spaceship::ConnectAPI client.patch_app_preview_set_previews(app_preview_set_id: id, app_preview_ids: app_preview_ids) return client.get_app_preview_set(app_preview_set_id: id, includes: "appPreviews").first end |
#upload_preview(client: nil, path: nil, wait_for_processing: true, position: nil, frame_time_code: nil) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'spaceship/lib/spaceship/connect_api/models/app_preview_set.rb', line 79 def upload_preview(client: nil, path: nil, wait_for_processing: true, position: nil, frame_time_code: nil) client ||= Spaceship::ConnectAPI # Upload preview preview = Spaceship::ConnectAPI::AppPreview.create(client: client, app_preview_set_id: id, path: path, wait_for_processing: wait_for_processing, frame_time_code: frame_time_code) # Reposition (if specified) unless position.nil? # Get all app preview ids set = AppPreviewSet.get(app_preview_set_id: id) app_preview_ids = set.app_previews.map(&:id) # Remove new uploaded preview app_preview_ids.delete(preview.id) # Insert preview at specified position app_preview_ids = app_preview_ids.insert(position, preview.id).compact # Reorder previews reorder_previews(app_preview_ids: app_preview_ids) end return preview end |