Class: PDFGeneratorAPI::TemplateVersionsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/pdf_generator_api_client/api/template_versions_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ TemplateVersionsApi

Returns a new instance of TemplateVersionsApi.



19
20
21
# File 'lib/pdf_generator_api_client/api/template_versions_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/pdf_generator_api_client/api/template_versions_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_template_version(template_id, template_version, opts = {}) ⇒ nil

Delete template version Deletes the specified template version. Production versions cannot be deleted.

Parameters:

  • template_id (Integer)

    Template unique identifier

  • template_version (Integer)

    Unique ID of the template version.

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

    the optional parameters

Returns:

  • (nil)


28
29
30
31
# File 'lib/pdf_generator_api_client/api/template_versions_api.rb', line 28

def delete_template_version(template_id, template_version, opts = {})
  delete_template_version_with_http_info(template_id, template_version, opts)
  nil
end

#delete_template_version_with_http_info(template_id, template_version, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete template version Deletes the specified template version. Production versions cannot be deleted.

Parameters:

  • template_id (Integer)

    Template unique identifier

  • template_version (Integer)

    Unique ID of the template version.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/pdf_generator_api_client/api/template_versions_api.rb', line 39

def delete_template_version_with_http_info(template_id, template_version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplateVersionsApi.delete_template_version ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplateVersionsApi.delete_template_version"
  end
  # verify the required parameter 'template_version' is set
  if @api_client.config.client_side_validation && template_version.nil?
    fail ArgumentError, "Missing the required parameter 'template_version' when calling TemplateVersionsApi.delete_template_version"
  end
  # resource path
  local_var_path = '/templates/{templateId}/versions/{templateVersion}'.sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s)).sub('{' + 'templateVersion' + '}', CGI.escape(template_version.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']) unless header_params['Accept']

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

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

  # return_type
  return_type = opts[:debug_return_type]

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

  new_options = opts.merge(
    :operation => :"TemplateVersionsApi.delete_template_version",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplateVersionsApi#delete_template_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_template_version(template_id, template_version, opts = {}) ⇒ InlineObject16

Get template version Returns the template definition of the specified version.

Parameters:

  • template_id (Integer)

    Template unique identifier

  • template_version (Integer)

    Unique ID of the template version.

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

    the optional parameters

Returns:



97
98
99
100
# File 'lib/pdf_generator_api_client/api/template_versions_api.rb', line 97

def get_template_version(template_id, template_version, opts = {})
  data, _status_code, _headers = get_template_version_with_http_info(template_id, template_version, opts)
  data
end

#get_template_version_with_http_info(template_id, template_version, opts = {}) ⇒ Array<(InlineObject16, Integer, Hash)>

Get template version Returns the template definition of the specified version.

Parameters:

  • template_id (Integer)

    Template unique identifier

  • template_version (Integer)

    Unique ID of the template version.

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

    the optional parameters

Returns:

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

    InlineObject16 data, response status code and response headers



108
109
110
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
# File 'lib/pdf_generator_api_client/api/template_versions_api.rb', line 108

def get_template_version_with_http_info(template_id, template_version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplateVersionsApi.get_template_version ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplateVersionsApi.get_template_version"
  end
  # verify the required parameter 'template_version' is set
  if @api_client.config.client_side_validation && template_version.nil?
    fail ArgumentError, "Missing the required parameter 'template_version' when calling TemplateVersionsApi.get_template_version"
  end
  # resource path
  local_var_path = '/templates/{templateId}/versions/{templateVersion}'.sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s)).sub('{' + 'templateVersion' + '}', CGI.escape(template_version.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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"TemplateVersionsApi.get_template_version",
    :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: TemplateVersionsApi#get_template_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_template_versions(template_id, opts = {}) ⇒ TemplateVersionCollection

List template versions Returns a paginated list of template versions for the specified template.

Parameters:

  • template_id (Integer)

    Template unique identifier

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

    the optional parameters

Options Hash (opts):

  • :per_page (Integer)

    Number of items per page.

  • :page (Integer)

    Page number to return.

Returns:



167
168
169
170
# File 'lib/pdf_generator_api_client/api/template_versions_api.rb', line 167

def list_template_versions(template_id, opts = {})
  data, _status_code, _headers = list_template_versions_with_http_info(template_id, opts)
  data
end

#list_template_versions_with_http_info(template_id, opts = {}) ⇒ Array<(TemplateVersionCollection, Integer, Hash)>

List template versions Returns a paginated list of template versions for the specified template.

Parameters:

  • template_id (Integer)

    Template unique identifier

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

    the optional parameters

Options Hash (opts):

  • :per_page (Integer)

    Number of items per page.

  • :page (Integer)

    Page number to return.

Returns:

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

    TemplateVersionCollection 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
226
227
# File 'lib/pdf_generator_api_client/api/template_versions_api.rb', line 179

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

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

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

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

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

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

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

  new_options = opts.merge(
    :operation => :"TemplateVersionsApi.list_template_versions",
    :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: TemplateVersionsApi#list_template_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#promote_template_version(template_id, template_version, opts = {}) ⇒ PromoteTemplateVersion200Response

Promote template version Promotes the specified template version to production. Only one version can be production at a time.

Parameters:

  • template_id (Integer)

    Template unique identifier

  • template_version (Integer)

    Unique ID of the template version.

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

    the optional parameters

Returns:



235
236
237
238
# File 'lib/pdf_generator_api_client/api/template_versions_api.rb', line 235

def promote_template_version(template_id, template_version, opts = {})
  data, _status_code, _headers = promote_template_version_with_http_info(template_id, template_version, opts)
  data
end

#promote_template_version_with_http_info(template_id, template_version, opts = {}) ⇒ Array<(PromoteTemplateVersion200Response, Integer, Hash)>

Promote template version Promotes the specified template version to production. Only one version can be production at a time.

Parameters:

  • template_id (Integer)

    Template unique identifier

  • template_version (Integer)

    Unique ID of the template version.

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

    the optional parameters

Returns:



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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/pdf_generator_api_client/api/template_versions_api.rb', line 246

def promote_template_version_with_http_info(template_id, template_version, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: TemplateVersionsApi.promote_template_version ...'
  end
  # verify the required parameter 'template_id' is set
  if @api_client.config.client_side_validation && template_id.nil?
    fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplateVersionsApi.promote_template_version"
  end
  # verify the required parameter 'template_version' is set
  if @api_client.config.client_side_validation && template_version.nil?
    fail ArgumentError, "Missing the required parameter 'template_version' when calling TemplateVersionsApi.promote_template_version"
  end
  # resource path
  local_var_path = '/templates/{templateId}/versions/{templateVersion}/promote'.sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s)).sub('{' + 'templateVersion' + '}', CGI.escape(template_version.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']) unless header_params['Accept']

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

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

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

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

  new_options = opts.merge(
    :operation => :"TemplateVersionsApi.promote_template_version",
    :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(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: TemplateVersionsApi#promote_template_version\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end