Class: StickyIoRestfulApiV2025731::ImagesController
- Inherits:
-
BaseController
- Object
- BaseController
- StickyIoRestfulApiV2025731::ImagesController
- Defined in:
- lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb
Overview
ImagesController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#attach_product_images(body, domain, v2_ext, product_id) ⇒ ApiResponse
Append image relationships to product, maintaining existing relationships.
-
#attach_variant_images(body, domain, v2_ext, product_id, variant_id) ⇒ ApiResponse
Append image relationships to product variant, maintaining existing relationships.
-
#create_image(image, malias, domain, v2_ext) ⇒ ApiResponse
Creates a new Image, it expects an URL for image, if you want to upload the file see ‘POST Upload Image` method.
-
#detach_product_image(domain, v2_ext, product_id, image_id) ⇒ ApiResponse
Detach a single image from a product.
-
#detach_variant_image(domain, v2_ext, product_id, variant_id, image_id) ⇒ ApiResponse
Detach a single image from a product variant.
-
#get_image(domain, v2_ext, image_id) ⇒ ApiResponse
Fetch the image for the given id or uuid **Response Data**\ Response parameters expected in the object contained within the ‘data` field object: | Field | Data Type | Description | | ———————————- | ———— | ————————————————————————– - | | id | Integer | The image id.
-
#get_product_image(domain, v2_ext, product_id, image_id) ⇒ ApiResponse
Fetch a single image associated with a product.
-
#get_product_images(domain, v2_ext, product_id) ⇒ ApiResponse
Fetch a list of images associated with a product.
-
#get_variant_image(domain, v2_ext, product_id, variant_id, image_id) ⇒ ApiResponse
Fetch a single image associated with a product variant.
-
#get_variant_images(domain, v2_ext, product_id, variant_id) ⇒ ApiResponse
Fetch a list of images associated with a product variant.
-
#list_images(search_updated_at, domain, v2_ext) ⇒ ApiResponse
Fetch all the images for the given parameters (all if none supplied) **Response Data**\ Response parameters expected in the object contained within the ‘data` field array: | Field | Data Type | Description | | ———————————- | ———— | ————————————————————————– - | | id | Integer | The image id.
-
#set_product_images(body, domain, v2_ext, product_id) ⇒ ApiResponse
Attach images to product only if none present.
-
#set_variant_images(body, domain, v2_ext, product_id, variant_id) ⇒ ApiResponse
Attach images to product variant only if none present.
-
#update_product_images(body, domain, v2_ext, product_id) ⇒ ApiResponse
Detach existing images from a product and attach requested images.
-
#update_variant_images(body, domain, v2_ext, product_id, variant_id) ⇒ ApiResponse
Detach existing images from a product variant and attach requested images.
-
#upload_image(image, malias, domain, v2_ext) ⇒ ApiResponse
Creates a new Image, it expects a file for image, if you want to use an URL see ‘POST Create Image` method here.
Methods inherited from BaseController
#initialize, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from StickyIoRestfulApiV2025731::BaseController
Instance Method Details
#attach_product_images(body, domain, v2_ext, product_id) ⇒ ApiResponse
Append image relationships to product, maintaining existing relationships. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description
|
| ——— | ———– | ——- | ———— | ————————————- | | image_ids | Required | - | Array | An array of image IDs or image UUIDs. | **Response Data**\ Response parameters contained within the ‘data` field array: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the default selected in email notifications when this product is ordered. | description here here
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 453 def attach_product_images(body, domain, v2_ext, product_id) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/.{domain}{v2_ext}products/{product_id}/images', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(AttachProductImages.method(:from_hash)) .is_api_response(true)) .execute end |
#attach_variant_images(body, domain, v2_ext, product_id, variant_id) ⇒ ApiResponse
Append image relationships to product variant, maintaining existing relationships. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description
|
| ——— | ———– | ——- | ———— | ————————————- | | image_ids | Required | - | Array | An array of image IDs or image UUIDs. | **Response Data**\ Response parameters contained within the ‘data` field array: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product variant. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the default selected in email notifications when this product variant is ordered. | description here here here
594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 594 def attach_variant_images(body, domain, v2_ext, product_id, variant_id) @api_call .request(new_request_builder(HttpMethodEnum::PATCH, '/.{domain}{v2_ext}products/{product_id}/variants/{variant_id}/images', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(variant_id, key: 'variant_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(AttachVariantImages.method(:from_hash)) .is_api_response(true)) .execute end |
#create_image(image, malias, domain, v2_ext) ⇒ ApiResponse
Creates a new Image, it expects an URL for image, if you want to upload the file see ‘POST Upload Image` method
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 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 52 def create_image(image, malias, domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}images', Server::SERVER_1) .query_param(new_parameter(image, key: 'image') .is_required(true)) .query_param(new_parameter(malias, key: 'alias') .is_required(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .auth(Single.new('basic'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#detach_product_image(domain, v2_ext, product_id, image_id) ⇒ ApiResponse
Detach a single image from a product. **Response Data**\ No data is returned. Look for a standard standard ‘SUCCESS` indicator in the `status` field. here
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 313 def detach_product_image(domain, v2_ext, product_id, image_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}products/{product_id}/images/{image_id}', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(image_id, key: 'image_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(DetachProductImage.method(:from_hash)) .is_api_response(true)) .execute end |
#detach_variant_image(domain, v2_ext, product_id, variant_id, image_id) ⇒ ApiResponse
Detach a single image from a product variant. **Response Data**\ No data is returned. Look for a standard standard ‘SUCCESS` indicator in the `status` field. here here
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 767 def detach_variant_image(domain, v2_ext, product_id, variant_id, image_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}products/{product_id}/variants/{variant_id}/images/{image_id}', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(variant_id, key: 'variant_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(image_id, key: 'image_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(DetachVariantImage.method(:from_hash)) .is_api_response(true)) .execute end |
#get_image(domain, v2_ext, image_id) ⇒ ApiResponse
Fetch the image for the given id or uuid **Response Data**\ Response parameters expected in the object contained within the ‘data` field object: | Field | Data Type | Description
|
| ———————————- | ———— |
-
|
| id | Integer | The image id.
|
| uuid | String | The image uuid.
|
| alias | String | The image alias.
| |
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The image accesible path. | | is_default | Boolean | Whether the image is the default one for a product or not.
|
| is_default_email | Boolean | Whether the image is the default one for emailing or not.
|
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 164 def get_image(domain, v2_ext, image_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}images/{image_id}', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(image_id, key: 'image_id') .is_required(true) .should_encode(true)) .auth(Single.new('basic'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#get_product_image(domain, v2_ext, product_id, image_id) ⇒ ApiResponse
Fetch a single image associated with a product. **Response Data**\ Response parameters contained within the ‘data` field object: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the defaule selected in email notifications when this product is ordered. | here
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 218 def get_product_image(domain, v2_ext, product_id, image_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}products/{product_id}/images/{image_id}', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(image_id, key: 'image_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetProductImage.method(:from_hash)) .is_api_response(true)) .execute end |
#get_product_images(domain, v2_ext, product_id) ⇒ ApiResponse
Fetch a list of images associated with a product. **Response Data**\ Response parameters contained within the ‘data` field array: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the default selected in email notifications when this product is ordered. | here
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 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 277 def get_product_images(domain, v2_ext, product_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}products/{product_id}/images', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetProductImages.method(:from_hash)) .is_api_response(true)) .execute end |
#get_variant_image(domain, v2_ext, product_id, variant_id, image_id) ⇒ ApiResponse
Fetch a single image associated with a product variant. **Response Data**\ Response parameters contained within the ‘data` field object: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product variant. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the default selected in email notifications when this product variant is ordered. | here here
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 721 def get_variant_image(domain, v2_ext, product_id, variant_id, image_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}products/{product_id}/variants/{variant_id}/images/{image_id}', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(variant_id, key: 'variant_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(image_id, key: 'image_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetVariantImage.method(:from_hash)) .is_api_response(true)) .execute end |
#get_variant_images(domain, v2_ext, product_id, variant_id) ⇒ ApiResponse
Fetch a list of images associated with a product variant. **Response Data**\ Response parameters contained within the ‘data` field array: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product variant. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the default selected in email notifications when this product variant is ordered. | here here
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 659 def get_variant_images(domain, v2_ext, product_id, variant_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}products/{product_id}/variants/{variant_id}/images', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(variant_id, key: 'variant_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetVariantImages.method(:from_hash)) .is_api_response(true)) .execute end |
#list_images(search_updated_at, domain, v2_ext) ⇒ ApiResponse
Fetch all the images for the given parameters (all if none supplied) **Response Data**\ Response parameters expected in the object contained within the ‘data` field array: | Field | Data Type | Description
|
| ———————————- | ———— |
-
|
| id | Integer | The image id.
|
| uuid | String | The image uuid.
|
| alias | String | The image alias.
| |
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The image accesible path. | | is_default | Boolean | Whether the image is the default one for a product or not.
|
| is_default_email | Boolean | Whether the image is the default one for emailing or not.
|
description here
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 110 def list_images(search_updated_at, domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}images', Server::SERVER_1) .query_param(new_parameter(search_updated_at, key: 'search[updated_at]') .is_required(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .auth(Single.new('basic'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |
#set_product_images(body, domain, v2_ext, product_id) ⇒ ApiResponse
Attach images to product only if none present. NOTE: If images already exist on this product, you must use the ‘Attach Product Images` method. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description
|
| ——— | ———– | ——- | ———— | ————————————- | | image_ids | Required | - | Array | An array of image IDs or image UUIDs. | **Response Data**\ Response parameters contained within the ‘data` field array: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the default selected in email notifications when this product is ordered. | description here here
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 384 def set_product_images(body, domain, v2_ext, product_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}products/{product_id}/images', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SetProductImages.method(:from_hash)) .is_api_response(true)) .execute end |
#set_variant_images(body, domain, v2_ext, product_id, variant_id) ⇒ ApiResponse
Attach images to product variant only if none present. NOTE: If images already exist on this product variant, you must use the ‘Attach Variant Images` method. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description
|
| ——— | ———– | ——- | ———— | ————————————- | | image_ids | Required | - | Array | An array of image IDs or image UUIDs. | **Response Data**\ Response parameters contained within the ‘data` field array: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product variant. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the default selected in email notifications when this product variant is ordered. | description here here here
844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 844 def set_variant_images(body, domain, v2_ext, product_id, variant_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}products/{product_id}/variants/{variant_id}/images', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(variant_id, key: 'variant_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SetVariantImages.method(:from_hash)) .is_api_response(true)) .execute end |
#update_product_images(body, domain, v2_ext, product_id) ⇒ ApiResponse
Detach existing images from a product and attach requested images. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description
|
| ——— | ———– | ——- | ———— | ————————————- | | image_ids | Required | - | Array | An array of image IDs or image UUIDs. | **Response Data**\ Response parameters contained within the ‘data` field array: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the defaule selected in email notifications when this product is ordered. | description here here
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 522 def update_product_images(body, domain, v2_ext, product_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}products/{product_id}/images', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UpdateProductImages.method(:from_hash)) .is_api_response(true)) .execute end |
#update_variant_images(body, domain, v2_ext, product_id, variant_id) ⇒ ApiResponse
Detach existing images from a product variant and attach requested images. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description
|
| ——— | ———– | ——- | ———— | ————————————- | | image_ids | Required | - | Array | An array of image IDs or image UUIDs. | **Response Data**\ Response parameters contained within the ‘data` field array: | Field | Data Type | Description
|
| —————- | ———— | ———————————————————— | | id | Integer | The image ID.
|
| uuid | String | The image UUID.
|
| alias | String | The image alias.
|
| created_at | String | A timestamp that represents when the image was created. | | updated_at | String | A timestamp that represents when the image was last updated. | | path | String | The full image path.
|
| is_default | Integer Flag | A flag that determines whether or not the image is the default selected for its associated product variant. | | is_default_email | Integer Flag | A flag that determines whether or not the image is the default selected in email notifications when this product variant is ordered. | description here here here
919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 919 def update_variant_images(body, domain, v2_ext, product_id, variant_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}products/{product_id}/variants/{variant_id}/images', Server::SERVER_1) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body) .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(variant_id, key: 'variant_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(UpdateVariantImages.method(:from_hash)) .is_api_response(true)) .execute end |
#upload_image(image, malias, domain, v2_ext) ⇒ ApiResponse
Creates a new Image, it expects a file for image, if you want to use an URL see ‘POST Create Image` method here
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/images_controller.rb', line 18 def upload_image(image, malias, domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}images/upload', Server::SERVER_1) .multipart_param(new_parameter(image, key: 'image') .is_required(true) .default_content_type('application/octet-stream')) .form_param(new_parameter(malias, key: 'alias') .is_required(true)) .template_param(new_parameter(domain, key: 'domain') .is_required(true) .should_encode(true)) .template_param(new_parameter(v2_ext, key: 'v2_ext') .is_required(true) .should_encode(true)) .auth(Single.new('basic'))) .response(new_response_handler .is_response_void(true) .is_api_response(true)) .execute end |