Class: GroupDocsParserCloud::TemplateApi

Inherits:
Object
  • Object
show all
Defined in:
lib/groupdocs_parser_cloud/api/template_api.rb

Overview

GroupDocs.Parser Cloud API

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ TemplateApi

Initializes new instance of TemplateApi

Parameters:



43
44
45
46
47
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 43

def initialize(config)
  @config = config
  @api_client = ApiClient.new(config)
  @access_token = nil
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



34
35
36
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 34

def config
  @config
end

Class Method Details

.from_config(config) ⇒ TemplateApi

Initializes new instance of TemplateApi

Parameters:

Returns:



63
64
65
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 63

def self.from_config(config)
  return new(config)
end

.from_keys(app_sid, app_key) ⇒ TemplateApi

Initializes new instance of TemplateApi

Parameters:

  • Application (app_sid)

    identifier (App SID)

  • Application (app_key)

    private key (App Key)

Returns:



54
55
56
57
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 54

def self.from_keys(app_sid, app_key)
  config = Configuration.new(app_sid, app_key)
  return new(config)
end

Instance Method Details

#create_template(request) ⇒ TemplateResult

Create or update document template.

Parameters:

  • request

    create_template_request

Returns:



71
72
73
74
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 71

def create_template(request)
  data, _status_code, _headers = create_template_with_http_info(request)
  data
end

#create_template_with_http_info(request) ⇒ Array<(TemplateResult, Fixnum, Hash)>

Create or update document template.

TemplateResult data, response status code and response headers

Parameters:

  • request

    create_template_request

Returns:

Raises:

  • (ArgumentError)


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 81

def create_template_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? CreateTemplateRequest

  @api_client.config.logger.debug 'Calling API: TemplateApi.create_template ...' if @api_client.config.debugging
  # verify the required parameter 'options' is set
  raise ArgumentError, 'Missing the required parameter options when calling TemplateApi.create_template' if @api_client.config.client_side_validation && request.options.nil?
  # resource path
  local_var_path = '/parser/template'

  # 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(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request.options)
  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,
                                                    access_token: get_access_token,
                                                    return_type: 'TemplateResult')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    TemplateApi#create_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#delete_template(request) ⇒ nil

Delete document template.

Parameters:

  • request

    delete_template_request

Returns:

  • (nil)


123
124
125
126
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 123

def delete_template(request)
  delete_template_with_http_info(request)
  nil
end

#delete_template_with_http_info(request) ⇒ Array<(nil, Fixnum, Hash)>

Delete document template.

nil, response status code and response headers

Parameters:

  • request

    delete_template_request

Returns:

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

Raises:

  • (ArgumentError)


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
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 133

def delete_template_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? DeleteTemplateRequest

  @api_client.config.logger.debug 'Calling API: TemplateApi.delete_template ...' if @api_client.config.debugging
  # verify the required parameter 'options' is set
  raise ArgumentError, 'Missing the required parameter options when calling TemplateApi.delete_template' if @api_client.config.client_side_validation && request.options.nil?
  # resource path
  local_var_path = '/parser/template'

  # 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(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request.options)
  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,
                                                    access_token: get_access_token)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    TemplateApi#delete_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#get_template(request) ⇒ Template

Retrieve document template.

Parameters:

  • request

    get_template_request

Returns:



174
175
176
177
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 174

def get_template(request)
  data, _status_code, _headers = get_template_with_http_info(request)
  data
end

#get_template_with_http_info(request) ⇒ Array<(Template, Fixnum, Hash)>

Retrieve document template.

Template data, response status code and response headers

Parameters:

  • request

    get_template_request

Returns:

Raises:

  • (ArgumentError)


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
# File 'lib/groupdocs_parser_cloud/api/template_api.rb', line 184

def get_template_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? GetTemplateRequest

  @api_client.config.logger.debug 'Calling API: TemplateApi.get_template ...' if @api_client.config.debugging
  # verify the required parameter 'options' is set
  raise ArgumentError, 'Missing the required parameter options when calling TemplateApi.get_template' if @api_client.config.client_side_validation && request.options.nil?
  # resource path
  local_var_path = '/parser/template'

  # 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(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = @api_client.object_to_http_body(request.options)
  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,
                                                    access_token: get_access_token,
                                                    return_type: 'Template')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    TemplateApi#get_template\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end