Class: Printful::MockupGeneratorAPIClient
- Inherits:
-
Object
- Object
- Printful::MockupGeneratorAPIClient
- Defined in:
- lib/printful_client/api/mockup_generator_api_client.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_generator_task(id, create_generation_task, opts = {}) ⇒ CreateGeneratorTask200Response
Create a mockup generation task Creates an asynchronous mockup generation task.
-
#create_generator_task_with_http_info(id, create_generation_task, opts = {}) ⇒ Array<(CreateGeneratorTask200Response, Integer, Hash)>
Create a mockup generation task Creates an asynchronous mockup generation task.
-
#get_printfiles(id, opts = {}) ⇒ GetPrintfiles200Response
Retrieve product variant printfiles List of printfiles available for products variants.
-
#get_printfiles_with_http_info(id, opts = {}) ⇒ Array<(GetPrintfiles200Response, Integer, Hash)>
Retrieve product variant printfiles List of printfiles available for products variants.
-
#get_task(task_key, opts = {}) ⇒ CreateGeneratorTask200Response
Mockup generation task result Returns asynchronous mockup generation task result.
-
#get_task_with_http_info(task_key, opts = {}) ⇒ Array<(CreateGeneratorTask200Response, Integer, Hash)>
Mockup generation task result Returns asynchronous mockup generation task result.
-
#get_templates(id, opts = {}) ⇒ GetTemplates200Response
Layout templates Retrieve list of templates that can be used for client-side positioning.
-
#get_templates_with_http_info(id, opts = {}) ⇒ Array<(GetTemplates200Response, Integer, Hash)>
Layout templates Retrieve list of templates that can be used for client-side positioning.
-
#initialize(api_client = ApiClient.default) ⇒ MockupGeneratorAPIClient
constructor
A new instance of MockupGeneratorAPIClient.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ MockupGeneratorAPIClient
Returns a new instance of MockupGeneratorAPIClient.
19 20 21 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_generator_task(id, create_generation_task, opts = {}) ⇒ CreateGeneratorTask200Response
Create a mockup generation task Creates an asynchronous mockup generation task. Generation result can be retrieved using mockup generation task retrieval endpoint.
**Rate limiting**: Up to 10 requests per 60 seconds for established stores; 2 requests per 60 seconds for new stores. Currently available rate is returned in response headers. A 60 seconds lockout is applied if request count is exceeded. We also limit the number of files that may be generated to 20,000 files per account in a 24-hour period.
29 30 31 32 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 29 def create_generator_task(id, create_generation_task, opts = {}) data, _status_code, _headers = create_generator_task_with_http_info(id, create_generation_task, opts) data end |
#create_generator_task_with_http_info(id, create_generation_task, opts = {}) ⇒ Array<(CreateGeneratorTask200Response, Integer, Hash)>
Create a mockup generation task Creates an asynchronous mockup generation task. Generation result can be retrieved using mockup generation task retrieval endpoint.<br> **Rate limiting**: Up to 10 requests per 60 seconds for established stores; 2 requests per 60 seconds for new stores. Currently available rate is returned in response headers. A 60 seconds lockout is applied if request count is exceeded. We also limit the number of files that may be generated to 20,000 files per account in a 24-hour period.
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 95 96 97 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 41 def create_generator_task_with_http_info(id, create_generation_task, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MockupGeneratorAPIClient.create_generator_task ...' 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 MockupGeneratorAPIClient.create_generator_task" end # verify the required parameter 'create_generation_task' is set if @api_client.config.client_side_validation && create_generation_task.nil? fail ArgumentError, "Missing the required parameter 'create_generation_task' when calling MockupGeneratorAPIClient.create_generator_task" end # resource path local_var_path = '/mockup-generator/create-task/{id}'.sub('{' + 'id' + '}', CGI.escape(id.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']) # 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 header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(create_generation_task) # return_type return_type = opts[:debug_return_type] || 'CreateGeneratorTask200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"MockupGeneratorAPIClient.create_generator_task", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MockupGeneratorAPIClient#create_generator_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_printfiles(id, opts = {}) ⇒ GetPrintfiles200Response
Retrieve product variant printfiles List of printfiles available for products variants. Printfile indicates what file resolution should be used to create a mockup or submit an order. <div class="alert alert-info"> This endpoint uses DTG as a default printing technique for products with more than one technique available. For products with DTG and more techniques available please specify the correct technique in query by using the ‘technique` parameter. For more information read the <a href="#section/Mockup-Generator-API-examples">examples</a>. </div>
107 108 109 110 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 107 def get_printfiles(id, opts = {}) data, _status_code, _headers = get_printfiles_with_http_info(id, opts) data end |
#get_printfiles_with_http_info(id, opts = {}) ⇒ Array<(GetPrintfiles200Response, Integer, Hash)>
Retrieve product variant printfiles List of printfiles available for products variants. Printfile indicates what file resolution should be used to create a mockup or submit an order. <div class="alert alert-info"> This endpoint uses DTG as a default printing technique for products with more than one technique available. For products with DTG and more techniques available please specify the correct technique in query by using the `technique` parameter. For more information read the <a href="#section/Mockup-Generator-API-examples">examples</a>. </div>
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 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 120 def get_printfiles_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MockupGeneratorAPIClient.get_printfiles ...' 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 MockupGeneratorAPIClient.get_printfiles" end allowable_values = ["horizontal", "vertical"] if @api_client.config.client_side_validation && opts[:'orientation'] && !allowable_values.include?(opts[:'orientation']) fail ArgumentError, "invalid value for \"orientation\", must be one of #{allowable_values}" end # resource path local_var_path = '/mockup-generator/printfiles/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'orientation'] = opts[:'orientation'] if !opts[:'orientation'].nil? query_params[:'technique'] = opts[:'technique'] if !opts[:'technique'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetPrintfiles200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"MockupGeneratorAPIClient.get_printfiles", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MockupGeneratorAPIClient#get_printfiles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_task(task_key, opts = {}) ⇒ CreateGeneratorTask200Response
Mockup generation task result Returns asynchronous mockup generation task result. If generation task is completed, it will contain a list of generated mockups.
181 182 183 184 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 181 def get_task(task_key, opts = {}) data, _status_code, _headers = get_task_with_http_info(task_key, opts) data end |
#get_task_with_http_info(task_key, opts = {}) ⇒ Array<(CreateGeneratorTask200Response, Integer, Hash)>
Mockup generation task result Returns asynchronous mockup generation task result. If generation task is completed, it will contain a list of generated mockups.
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 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 192 def get_task_with_http_info(task_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MockupGeneratorAPIClient.get_task ...' end # verify the required parameter 'task_key' is set if @api_client.config.client_side_validation && task_key.nil? fail ArgumentError, "Missing the required parameter 'task_key' when calling MockupGeneratorAPIClient.get_task" end # resource path local_var_path = '/mockup-generator/task' # query parameters query_params = opts[:query_params] || {} query_params[:'task_key'] = task_key # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'CreateGeneratorTask200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"MockupGeneratorAPIClient.get_task", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MockupGeneratorAPIClient#get_task\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_templates(id, opts = {}) ⇒ GetTemplates200Response
Layout templates Retrieve list of templates that can be used for client-side positioning. <div class="alert alert-info"> This endpoint uses DTG as a default printing technique for product layouts with more than one technique available. For products with DTG and more techniques available please specify the correct technique in query by using the ‘technique` parameter. For more information read the <a href="#section/Mockup-Generator-API-examples">examples</a>. </div>
250 251 252 253 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 250 def get_templates(id, opts = {}) data, _status_code, _headers = get_templates_with_http_info(id, opts) data end |
#get_templates_with_http_info(id, opts = {}) ⇒ Array<(GetTemplates200Response, Integer, Hash)>
Layout templates Retrieve list of templates that can be used for client-side positioning. <div class="alert alert-info"> This endpoint uses DTG as a default printing technique for product layouts with more than one technique available. For products with DTG and more techniques available please specify the correct technique in query by using the `technique` parameter. For more information read the <a href="#section/Mockup-Generator-API-examples">examples</a>. </div>
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 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
# File 'lib/printful_client/api/mockup_generator_api_client.rb', line 263 def get_templates_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MockupGeneratorAPIClient.get_templates ...' 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 MockupGeneratorAPIClient.get_templates" end allowable_values = ["horizontal", "vertical"] if @api_client.config.client_side_validation && opts[:'orientation'] && !allowable_values.include?(opts[:'orientation']) fail ArgumentError, "invalid value for \"orientation\", must be one of #{allowable_values}" end # resource path local_var_path = '/mockup-generator/templates/{id}'.sub('{' + 'id' + '}', CGI.escape(id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'orientation'] = opts[:'orientation'] if !opts[:'orientation'].nil? query_params[:'technique'] = opts[:'technique'] if !opts[:'technique'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) header_params[:'X-PF-Store-Id'] = opts[:'x_pf_store_id'] if !opts[:'x_pf_store_id'].nil? # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'GetTemplates200Response' # auth_names auth_names = opts[:debug_auth_names] || ['OAuth'] = opts.merge( :operation => :"MockupGeneratorAPIClient.get_templates", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MockupGeneratorAPIClient#get_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |