Class: Shotstack::EditApi

Inherits:
Object
  • Object
show all
Defined in:
lib/shotstack/api/edit_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EditApi

Returns a new instance of EditApi.



19
20
21
# File 'lib/shotstack/api/edit_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/shotstack/api/edit_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_render(id, opts = {}) ⇒ RenderResponse

Get Render Status Get the rendering status, temporary asset url and details of a render by ID. **Base URL:** api.shotstack.io/version

Parameters:

  • id (String)

    The id of the timeline render task in UUID format

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :data (Boolean)

    Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.<br><br><b>Note:</b> the default is currently `true`, this is deprecated and the default will soon be `false`. If you rely on the data being returned in the response you should explicitly set the parameter to `true`.

  • :merged (Boolean)

    Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response.

Returns:



29
30
31
32
# File 'lib/shotstack/api/edit_api.rb', line 29

def get_render(id, opts = {})
  data, _status_code, _headers = get_render_with_http_info(id, opts)
  data
end

#get_render_with_http_info(id, opts = {}) ⇒ Array<(RenderResponse, Integer, Hash)>

Get Render Status Get the rendering status, temporary asset url and details of a render by ID. **Base URL:** api.shotstack.io/version

Parameters:

  • id (String)

    The id of the timeline render task in UUID format

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :data (Boolean)

    Include the data parameter in the response. The data parameter includes the original timeline, output and other settings sent to the API.&lt;br&gt;&lt;br&gt;&lt;b&gt;Note:&lt;/b&gt; the default is currently &#x60;true&#x60;, this is deprecated and the default will soon be &#x60;false&#x60;. If you rely on the data being returned in the response you should explicitly set the parameter to &#x60;true&#x60;.

  • :merged (Boolean)

    Used when data is set to true, it will show the [merge fields](#tocs_mergefield) merged in to the data response.

Returns:

  • (Array<(RenderResponse, Integer, Hash)>)

    RenderResponse data, response status code and response headers



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
# File 'lib/shotstack/api/edit_api.rb', line 41

def get_render_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditApi.get_render ...'
  end
  # verify the required parameter 'id' is set
  if @api_client.config.client_side_validation && id.nil?
    fail ArgumentError, "Missing the required parameter 'id' when calling EditApi.get_render"
  end
  pattern = Regexp.new(/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/)
  if @api_client.config.client_side_validation && id !~ pattern
    fail ArgumentError, "invalid value for 'id' when calling EditApi.get_render, must conform to the pattern #{pattern}."
  end

  # resource path
  local_var_path = '/render/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'data'] = opts[:'data'] if !opts[:'data'].nil?
  query_params[:'merged'] = opts[:'merged'] if !opts[:'merged'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'RenderResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['DeveloperKey']

  new_options = opts.merge(
    :operation => :"EditApi.get_render",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditApi#get_render\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_render(edit, opts = {}) ⇒ QueuedResponse

Render Asset Queue and render the contents of a timeline as a video, image or audio file. **Base URL:** api.shotstack.io/version

Parameters:

  • edit (Edit)

    The video, image or audio edit specified using JSON.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



101
102
103
104
# File 'lib/shotstack/api/edit_api.rb', line 101

def post_render(edit, opts = {})
  data, _status_code, _headers = post_render_with_http_info(edit, opts)
  data
end

#post_render_with_http_info(edit, opts = {}) ⇒ Array<(QueuedResponse, Integer, Hash)>

Render Asset Queue and render the contents of a timeline as a video, image or audio file. **Base URL:** api.shotstack.io/version

Parameters:

  • edit (Edit)

    The video, image or audio edit specified using JSON.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(QueuedResponse, Integer, Hash)>)

    QueuedResponse data, response status code and response headers



111
112
113
114
115
116
117
118
119
120
121
122
123
124
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
# File 'lib/shotstack/api/edit_api.rb', line 111

def post_render_with_http_info(edit, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditApi.post_render ...'
  end
  # verify the required parameter 'edit' is set
  if @api_client.config.client_side_validation && edit.nil?
    fail ArgumentError, "Missing the required parameter 'edit' when calling EditApi.post_render"
  end
  # resource path
  local_var_path = '/render'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(edit)

  # return_type
  return_type = opts[:debug_return_type] || 'QueuedResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['DeveloperKey']

  new_options = opts.merge(
    :operation => :"EditApi.post_render",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditApi#post_render\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#probe(url, opts = {}) ⇒ ProbeResponse

Inspect Media Inspects any media asset (image, video, audio) on the internet using a hosted version of [FFprobe](ffmpeg.org/ffprobe.html). The probe endpoint returns useful information about an asset such as width, height, duration, rotation, framerate, etc… **Base URL:** api.shotstack.io/version

Parameters:

  • url (String)

    The URL of the media to inspect, must be **URL encoded**.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



169
170
171
172
# File 'lib/shotstack/api/edit_api.rb', line 169

def probe(url, opts = {})
  data, _status_code, _headers = probe_with_http_info(url, opts)
  data
end

#probe_with_http_info(url, opts = {}) ⇒ Array<(ProbeResponse, Integer, Hash)>

Inspect Media Inspects any media asset (image, video, audio) on the internet using a hosted version of [FFprobe](ffmpeg.org/ffprobe.html). The probe endpoint returns useful information about an asset such as width, height, duration, rotation, framerate, etc… **Base URL:** api.shotstack.io/version

Parameters:

  • url (String)

    The URL of the media to inspect, must be **URL encoded**.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ProbeResponse, Integer, Hash)>)

    ProbeResponse data, response status code and response headers



179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/shotstack/api/edit_api.rb', line 179

def probe_with_http_info(url, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EditApi.probe ...'
  end
  # verify the required parameter 'url' is set
  if @api_client.config.client_side_validation && url.nil?
    fail ArgumentError, "Missing the required parameter 'url' when calling EditApi.probe"
  end
  # resource path
  local_var_path = '/probe/{url}'.sub('{' + 'url' + '}', CGI.escape(url.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'ProbeResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['DeveloperKey']

  new_options = opts.merge(
    :operation => :"EditApi.probe",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EditApi#probe\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end