Class: Aimastering::MasteringApi

Inherits:
Object
  • Object
show all
Defined in:
lib/aimastering/api/mastering_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ MasteringApi

Returns a new instance of MasteringApi.



19
20
21
# File 'lib/aimastering/api/mastering_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/aimastering/api/mastering_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#cancel_mastering(id, opts = {}) ⇒ Mastering

Cancel a mastering by id.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Returns:



28
29
30
31
# File 'lib/aimastering/api/mastering_api.rb', line 28

def cancel_mastering(id, opts = {})
  data, _status_code, _headers = cancel_mastering_with_http_info(id, opts)
  return data
end

#cancel_mastering_with_http_info(id, opts = {}) ⇒ Array<(Mastering, Fixnum, Hash)>

Cancel a mastering by id.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Returns:

  • (Array<(Mastering, Fixnum, Hash)>)

    Mastering data, response status code and response headers



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
# File 'lib/aimastering/api/mastering_api.rb', line 38

def cancel_mastering_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MasteringApi.cancel_mastering ..."
  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 MasteringApi.cancel_mastering"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling MasteringApi.cancel_mastering, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = "/masterings/{id}/cancel".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['bearer']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Mastering')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MasteringApi#cancel_mastering\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_mastering(input_audio_id, opts = {}) ⇒ Mastering

Create a new mastering.

Parameters:

  • input_audio_id

    Input audio id

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

    the optional parameters

Options Hash (opts):

  • :mode (String)

    Mode (default to default)

  • :bass_preservation (BOOLEAN)

    This parameter represents if the bass preservation is enabled. (default to false)

  • :mastering (BOOLEAN)

    This parameter represents if the mastering is enabled. This parameter is effective only when the mode is &quot;default&quot; or &quot;custom&quot;. (default to true)

  • :preset (String)

    This parameter is effective only when the mode is &quot;preset&quot;. (default to general)

  • :target_loudness (Float)

    This parameter represents the target loudness of the output audio in dB. This parameter is effective only when the mode is &quot;custom&quot;. (default to -5.0)

  • :mastering_matching_level (Float)

    This parameter represents the mastering reference matching level. This parameter is effective only when the mode is &quot;custom&quot; and the mastering is enabled. (default to 0.5)

  • :mastering_reverb (BOOLEAN)

    This parameter represents if the mastering reverb is enabled. This parameter is effective only when the mode is &quot;custom&quot; and the mastering is enabled. (default to false)

  • :mastering_reverb_gain (Float)

    This parameter represents the mastering reverb gain relative to the dry sound in dB. This parameter is effective only when the mode is &quot;custom&quot; and the mastering is &quot;true&quot; and the mastering_reverb is &quot;true&quot;. (default to -36.0)

  • :reference_audio_id (Integer)

    Reference audio id. This parameter is effective only when the mode is &quot;custom&quot; and the mastering is enabled.

  • :low_cut_freq (Float)

    This parameter represents the low cut freq of the output audio in Hz. This parameter is effective only when the mode is &quot;custom&quot;. (default to 20.0)

  • :high_cut_freq (Float)

    This parameter represents the target loudness of the output audio in Hz. This parameter is effective only when the mode is &quot;custom&quot;. (default to 20000.0)

  • :sample_rate (Integer)

    This parameter represents the sample rate of the output audio in dB. This parameter is effective only when the mode is &quot;custom&quot;. (default to 44100)

  • :bit_depth (Integer)

    This parameter represents the bit depth of the output audio in dB. This parameter is effective only when the mode is &quot;custom&quot;. (default to 16)

  • :output_format (String)

    This parameter represents the format of the output audio. This parameter is effective only when the mode is &quot;custom&quot;. (default to wav)

  • :for_preview (BOOLEAN)

    If this is true, the mastering is treated for preview purpose (ex. not purchasable, not publishable, short lifetime). (default to false)

  • :start_at (Float)

    Partial mastering start at. (default to 0.0)

  • :end_at (Float)

    Partial mastering end at. (default to -1.0)

  • :is_bakuage (BOOLEAN)

    Deprecated. For backward compatibility. (default to false)

Returns:



103
104
105
106
# File 'lib/aimastering/api/mastering_api.rb', line 103

def create_mastering(input_audio_id, opts = {})
  data, _status_code, _headers = create_mastering_with_http_info(input_audio_id, opts)
  return data
end

#create_mastering_with_http_info(input_audio_id, opts = {}) ⇒ Array<(Mastering, Fixnum, Hash)>

Create a new mastering.

Parameters:

  • input_audio_id

    Input audio id

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

    the optional parameters

Options Hash (opts):

  • :mode (String)

    Mode

  • :bass_preservation (BOOLEAN)

    This parameter represents if the bass preservation is enabled.

  • :mastering (BOOLEAN)

    This parameter represents if the mastering is enabled. This parameter is effective only when the mode is &quot;default&quot; or &quot;custom&quot;.

  • :preset (String)

    This parameter is effective only when the mode is &quot;preset&quot;.

  • :target_loudness (Float)

    This parameter represents the target loudness of the output audio in dB. This parameter is effective only when the mode is &quot;custom&quot;.

  • :mastering_matching_level (Float)

    This parameter represents the mastering reference matching level. This parameter is effective only when the mode is &quot;custom&quot; and the mastering is enabled.

  • :mastering_reverb (BOOLEAN)

    This parameter represents if the mastering reverb is enabled. This parameter is effective only when the mode is &quot;custom&quot; and the mastering is enabled.

  • :mastering_reverb_gain (Float)

    This parameter represents the mastering reverb gain relative to the dry sound in dB. This parameter is effective only when the mode is &quot;custom&quot; and the mastering is &quot;true&quot; and the mastering_reverb is &quot;true&quot;.

  • :reference_audio_id (Integer)

    Reference audio id. This parameter is effective only when the mode is &quot;custom&quot; and the mastering is enabled.

  • :low_cut_freq (Float)

    This parameter represents the low cut freq of the output audio in Hz. This parameter is effective only when the mode is &quot;custom&quot;.

  • :high_cut_freq (Float)

    This parameter represents the target loudness of the output audio in Hz. This parameter is effective only when the mode is &quot;custom&quot;.

  • :sample_rate (Integer)

    This parameter represents the sample rate of the output audio in dB. This parameter is effective only when the mode is &quot;custom&quot;.

  • :bit_depth (Integer)

    This parameter represents the bit depth of the output audio in dB. This parameter is effective only when the mode is &quot;custom&quot;.

  • :output_format (String)

    This parameter represents the format of the output audio. This parameter is effective only when the mode is &quot;custom&quot;.

  • :for_preview (BOOLEAN)

    If this is true, the mastering is treated for preview purpose (ex. not purchasable, not publishable, short lifetime).

  • :start_at (Float)

    Partial mastering start at.

  • :end_at (Float)

    Partial mastering end at.

  • :is_bakuage (BOOLEAN)

    Deprecated. For backward compatibility.

Returns:

  • (Array<(Mastering, Fixnum, Hash)>)

    Mastering data, response status code and response headers



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
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
# File 'lib/aimastering/api/mastering_api.rb', line 131

def create_mastering_with_http_info(input_audio_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MasteringApi.create_mastering ..."
  end
  # verify the required parameter 'input_audio_id' is set
  if @api_client.config.client_side_validation && input_audio_id.nil?
    fail ArgumentError, "Missing the required parameter 'input_audio_id' when calling MasteringApi.create_mastering"
  end
  if @api_client.config.client_side_validation && input_audio_id < 1
    fail ArgumentError, 'invalid value for "input_audio_id" when calling MasteringApi.create_mastering, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && opts[:'mode'] && !['default', 'custom', 'preset'].include?(opts[:'mode'])
    fail ArgumentError, 'invalid value for "mode", must be one of default, custom, preset'
  end
  if @api_client.config.client_side_validation && opts[:'preset'] && !['general', 'pop', 'classical', 'jazz'].include?(opts[:'preset'])
    fail ArgumentError, 'invalid value for "preset", must be one of general, pop, classical, jazz'
  end
  if @api_client.config.client_side_validation && !opts[:'mastering_matching_level'].nil? && opts[:'mastering_matching_level'] > 1
    fail ArgumentError, 'invalid value for "opts[:"mastering_matching_level"]" when calling MasteringApi.create_mastering, must be smaller than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'mastering_matching_level'].nil? && opts[:'mastering_matching_level'] < 0
    fail ArgumentError, 'invalid value for "opts[:"mastering_matching_level"]" when calling MasteringApi.create_mastering, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'reference_audio_id'].nil? && opts[:'reference_audio_id'] < 1
    fail ArgumentError, 'invalid value for "opts[:"reference_audio_id"]" when calling MasteringApi.create_mastering, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'low_cut_freq'].nil? && opts[:'low_cut_freq'] < 0
    fail ArgumentError, 'invalid value for "opts[:"low_cut_freq"]" when calling MasteringApi.create_mastering, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && !opts[:'high_cut_freq'].nil? && opts[:'high_cut_freq'] < 0
    fail ArgumentError, 'invalid value for "opts[:"high_cut_freq"]" when calling MasteringApi.create_mastering, must be greater than or equal to 0.'
  end

  if @api_client.config.client_side_validation && opts[:'output_format'] && !['wav', 'mp3'].include?(opts[:'output_format'])
    fail ArgumentError, 'invalid value for "output_format", must be one of wav, mp3'
  end
  # resource path
  local_var_path = "/masterings"

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params["input_audio_id"] = input_audio_id
  form_params["mode"] = opts[:'mode'] if !opts[:'mode'].nil?
  form_params["bass_preservation"] = opts[:'bass_preservation'] if !opts[:'bass_preservation'].nil?
  form_params["mastering"] = opts[:'mastering'] if !opts[:'mastering'].nil?
  form_params["preset"] = opts[:'preset'] if !opts[:'preset'].nil?
  form_params["target_loudness"] = opts[:'target_loudness'] if !opts[:'target_loudness'].nil?
  form_params["mastering_matching_level"] = opts[:'mastering_matching_level'] if !opts[:'mastering_matching_level'].nil?
  form_params["mastering_reverb"] = opts[:'mastering_reverb'] if !opts[:'mastering_reverb'].nil?
  form_params["mastering_reverb_gain"] = opts[:'mastering_reverb_gain'] if !opts[:'mastering_reverb_gain'].nil?
  form_params["reference_audio_id"] = opts[:'reference_audio_id'] if !opts[:'reference_audio_id'].nil?
  form_params["low_cut_freq"] = opts[:'low_cut_freq'] if !opts[:'low_cut_freq'].nil?
  form_params["high_cut_freq"] = opts[:'high_cut_freq'] if !opts[:'high_cut_freq'].nil?
  form_params["sample_rate"] = opts[:'sample_rate'] if !opts[:'sample_rate'].nil?
  form_params["bit_depth"] = opts[:'bit_depth'] if !opts[:'bit_depth'].nil?
  form_params["output_format"] = opts[:'output_format'] if !opts[:'output_format'].nil?
  form_params["for_preview"] = opts[:'for_preview'] if !opts[:'for_preview'].nil?
  form_params["start_at"] = opts[:'start_at'] if !opts[:'start_at'].nil?
  form_params["end_at"] = opts[:'end_at'] if !opts[:'end_at'].nil?
  form_params["is_bakuage"] = opts[:'is_bakuage'] if !opts[:'is_bakuage'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['bearer']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Mastering')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MasteringApi#create_mastering\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_mastering(id, opts = {}) ⇒ Mastering

Delete mastering.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Returns:



228
229
230
231
# File 'lib/aimastering/api/mastering_api.rb', line 228

def delete_mastering(id, opts = {})
  data, _status_code, _headers = delete_mastering_with_http_info(id, opts)
  return data
end

#delete_mastering_with_http_info(id, opts = {}) ⇒ Array<(Mastering, Fixnum, Hash)>

Delete mastering.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Returns:

  • (Array<(Mastering, Fixnum, Hash)>)

    Mastering data, response status code and response headers



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
# File 'lib/aimastering/api/mastering_api.rb', line 238

def delete_mastering_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MasteringApi.delete_mastering ..."
  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 MasteringApi.delete_mastering"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling MasteringApi.delete_mastering, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = "/masterings/{id}".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['bearer']
  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Mastering')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MasteringApi#delete_mastering\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_mastering(id, opts = {}) ⇒ Mastering

Get a mastering by id.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Returns:



285
286
287
288
# File 'lib/aimastering/api/mastering_api.rb', line 285

def get_mastering(id, opts = {})
  data, _status_code, _headers = get_mastering_with_http_info(id, opts)
  return data
end

#get_mastering_unlock_product(id, opts = {}) ⇒ Mastering

Review a mastering by id.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Returns:



342
343
344
345
# File 'lib/aimastering/api/mastering_api.rb', line 342

def get_mastering_unlock_product(id, opts = {})
  data, _status_code, _headers = get_mastering_unlock_product_with_http_info(id, opts)
  return data
end

#get_mastering_unlock_product_with_http_info(id, opts = {}) ⇒ Array<(Mastering, Fixnum, Hash)>

Review a mastering by id.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Returns:

  • (Array<(Mastering, Fixnum, Hash)>)

    Mastering data, response status code and response headers



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/aimastering/api/mastering_api.rb', line 352

def get_mastering_unlock_product_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MasteringApi.get_mastering_unlock_product ..."
  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 MasteringApi.get_mastering_unlock_product"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling MasteringApi.get_mastering_unlock_product, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = "/masterings/{id}/unlock_product".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['bearer']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Mastering')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MasteringApi#get_mastering_unlock_product\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_mastering_with_http_info(id, opts = {}) ⇒ Array<(Mastering, Fixnum, Hash)>

Get a mastering by id.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Returns:

  • (Array<(Mastering, Fixnum, Hash)>)

    Mastering data, response status code and response headers



295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/aimastering/api/mastering_api.rb', line 295

def get_mastering_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MasteringApi.get_mastering ..."
  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 MasteringApi.get_mastering"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling MasteringApi.get_mastering, must be greater than or equal to 1.'
  end

  # resource path
  local_var_path = "/masterings/{id}".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['bearer']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Mastering')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MasteringApi#get_mastering\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_masterings(opts = {}) ⇒ Array<Mastering>

Get all accessable masterings.

Parameters:

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

    the optional parameters

Returns:



398
399
400
401
# File 'lib/aimastering/api/mastering_api.rb', line 398

def list_masterings(opts = {})
  data, _status_code, _headers = list_masterings_with_http_info(opts)
  return data
end

#list_masterings_with_http_info(opts = {}) ⇒ Array<(Array<Mastering>, Fixnum, Hash)>

Get all accessable masterings.

Parameters:

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

    the optional parameters

Returns:

  • (Array<(Array<Mastering>, Fixnum, Hash)>)

    Array<Mastering> data, response status code and response headers



407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/aimastering/api/mastering_api.rb', line 407

def list_masterings_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MasteringApi.list_masterings ..."
  end
  # resource path
  local_var_path = "/masterings"

  # query parameters
  query_params = {}

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

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  auth_names = ['bearer']
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Array<Mastering>')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MasteringApi#list_masterings\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#publish_mastering(id, access_token, message, opts = {}) ⇒ Mastering

Publish a mastering by id.

Parameters:

  • id

    Mastering id

  • access_token

    This parameter represents if the access token of the publishment service API.

  • message

    This parameter represents the publishment message.

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

    the optional parameters

Options Hash (opts):

  • :service (String)

    This parameter represents the publishment service.

  • :access_token_secret (String)

    This parameter represents the access token secret of the publishment service API. This parameter is effective only when the service is &quot;twitter&quot;.

Returns:



450
451
452
453
# File 'lib/aimastering/api/mastering_api.rb', line 450

def publish_mastering(id, access_token, message, opts = {})
  data, _status_code, _headers = publish_mastering_with_http_info(id, access_token, message, opts)
  return data
end

#publish_mastering_with_http_info(id, access_token, message, opts = {}) ⇒ Array<(Mastering, Fixnum, Hash)>

Publish a mastering by id.

Parameters:

  • id

    Mastering id

  • access_token

    This parameter represents if the access token of the publishment service API.

  • message

    This parameter represents the publishment message.

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

    the optional parameters

Options Hash (opts):

  • :service (String)

    This parameter represents the publishment service.

  • :access_token_secret (String)

    This parameter represents the access token secret of the publishment service API. This parameter is effective only when the service is &quot;twitter&quot;.

Returns:

  • (Array<(Mastering, Fixnum, Hash)>)

    Mastering data, response status code and response headers



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
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
# File 'lib/aimastering/api/mastering_api.rb', line 464

def publish_mastering_with_http_info(id, access_token, message, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MasteringApi.publish_mastering ..."
  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 MasteringApi.publish_mastering"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling MasteringApi.publish_mastering, must be greater than or equal to 1.'
  end

  # verify the required parameter 'access_token' is set
  if @api_client.config.client_side_validation && access_token.nil?
    fail ArgumentError, "Missing the required parameter 'access_token' when calling MasteringApi.publish_mastering"
  end
  # verify the required parameter 'message' is set
  if @api_client.config.client_side_validation && message.nil?
    fail ArgumentError, "Missing the required parameter 'message' when calling MasteringApi.publish_mastering"
  end
  if @api_client.config.client_side_validation && opts[:'service'] && !['twitter', 'youtube'].include?(opts[:'service'])
    fail ArgumentError, 'invalid value for "service", must be one of twitter, youtube'
  end
  # resource path
  local_var_path = "/masterings/{id}/publish".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params["access_token"] = access_token
  form_params["message"] = message
  form_params["service"] = opts[:'service'] if !opts[:'service'].nil?
  form_params["access_token_secret"] = opts[:'access_token_secret'] if !opts[:'access_token_secret'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['bearer']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Mastering')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MasteringApi#publish_mastering\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#review_mastering(id, opts = {}) ⇒ Mastering

Review a mastering by id.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Options Hash (opts):

  • :review_comment (String)

    This parameter represents the review comment.

  • :review_score (Float)

    This parameter represents the review score.

Returns:



530
531
532
533
# File 'lib/aimastering/api/mastering_api.rb', line 530

def review_mastering(id, opts = {})
  data, _status_code, _headers = review_mastering_with_http_info(id, opts)
  return data
end

#review_mastering_with_http_info(id, opts = {}) ⇒ Array<(Mastering, Fixnum, Hash)>

Review a mastering by id.

Parameters:

  • id

    Mastering id

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

    the optional parameters

Options Hash (opts):

  • :review_comment (String)

    This parameter represents the review comment.

  • :review_score (Float)

    This parameter represents the review score.

Returns:

  • (Array<(Mastering, Fixnum, Hash)>)

    Mastering data, response status code and response headers



542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
# File 'lib/aimastering/api/mastering_api.rb', line 542

def review_mastering_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug "Calling API: MasteringApi.review_mastering ..."
  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 MasteringApi.review_mastering"
  end
  if @api_client.config.client_side_validation && id < 1
    fail ArgumentError, 'invalid value for "id" when calling MasteringApi.review_mastering, must be greater than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'review_score'].nil? && opts[:'review_score'] > 1
    fail ArgumentError, 'invalid value for "opts[:"review_score"]" when calling MasteringApi.review_mastering, must be smaller than or equal to 1.'
  end

  if @api_client.config.client_side_validation && !opts[:'review_score'].nil? && opts[:'review_score'] < 0
    fail ArgumentError, 'invalid value for "opts[:"review_score"]" when calling MasteringApi.review_mastering, must be greater than or equal to 0.'
  end

  # resource path
  local_var_path = "/masterings/{id}/review".sub('{' + 'id' + '}', id.to_s)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = {}
  form_params["review_comment"] = opts[:'review_comment'] if !opts[:'review_comment'].nil?
  form_params["review_score"] = opts[:'review_score'] if !opts[:'review_score'].nil?

  # http body (model)
  post_body = nil
  auth_names = ['bearer']
  data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'Mastering')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: MasteringApi#review_mastering\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end