Class: StickyIoRestfulApiV2025731::InventoriesController

Inherits:
BaseController
  • Object
show all
Defined in:
lib/sticky_io_restful_api_v2025731/controllers/inventories_controller.rb

Overview

InventoriesController

Constant Summary

Constants inherited from BaseController

BaseController::GLOBAL_ERRORS

Instance Attribute Summary

Attributes inherited from BaseController

#config, #http_call_back

Instance Method Summary collapse

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

#get_all_inventories(domain, v2_ext) ⇒ ApiResponse

This method is used to get all Inventories. ## Response Parameters Response parameters contained within the ‘data` field object: | Parameter | Type | Description | | — | — | — | | id | int | This is the ID for the related inventory. | | product_id | int | This is the product id of the related inventory. | | quantity | int | This is the current quantity (initial excludes shipped) | | allocated_quantity | int | This is the purchased quantity but not shipped yet.
(after shipping item quantity gets decremented) | | product_name | string | This is the name of the product. | | sku | string | The product SKU identifier. | | warehouse_info | json | Warehouse object related to inventory.
(Warehouse id and name will be inside of this object) | | variant_info | json | This is the variant info object of the product. This will show only if product has variants. |

Parameters:

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/sticky_io_restful_api_v2025731/controllers/inventories_controller.rb', line 29

def get_all_inventories(domain,
                        v2_ext)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/.{domain}{v2_ext}inventories',
                                 Server::SERVER_1)
               .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

#get_product_inventories(domain, v2_ext, product_id) ⇒ ApiResponse

Get all inventories for a single product by passing product id in URL. ## Response Parameters Response parameters contained within the ‘data` field object: | Parameter | Type | Description | | — | — | — | | id | int | This is the ID for the related inventory. | | product_id | int | This is the product id of the related inventory. | | quantity | int | This is the current quantity (initial excludes shipped) | | allocated_quantity | int | This is the purchased quantity but not shipped yet. (after shipping item quantity gets decremented) | | product_name | string | This is the name of the product. | | sku | string | The product SKU identifier. | | warehouse_info | json | Warehouse object related to inventory. (Warehouse id and name will be inside of this object) | here

Parameters:

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

  • product_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/sticky_io_restful_api_v2025731/controllers/inventories_controller.rb', line 68

def get_product_inventories(domain,
                            v2_ext,
                            product_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/.{domain}{v2_ext}products/{product_id}/inventory',
                                 Server::SERVER_1)
               .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))
               .auth(Single.new('basic')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end

#get_variant_inventory(domain, v2_ext, product_id, variant_id) ⇒ ApiResponse

## Response Parameters Response parameters contained within the ‘data` field object: | Parameter | Type | Description | | — | — | — | | id | int | This is the ID for the related inventory. | | product_id | int | This is the product id of the related inventory. | | quantity | int | This is the current quantity (initial excludes shipped) | | allocated_quantity | int | This is the purchased quantity but not shipped yet. (after shipping item quantity gets decremented) | | product_name | string | This is the name of the product. | | sku | string | The product SKU identifier. | | warehouse_info | json | Warehouse object related to inventory. (Warehouse id and name will be inside of this object) | | variant_info | json | This is the variant info object of the product. | here here

Parameters:

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

  • product_id (String)

    Required parameter: TODO: type description

  • variant_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/sticky_io_restful_api_v2025731/controllers/inventories_controller.rb', line 251

def get_variant_inventory(domain,
                          v2_ext,
                          product_id,
                          variant_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/.{domain}{v2_ext}products/{product_id}/variants/{variant_id}/inventory',
                                 Server::SERVER_1)
               .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))
               .auth(Single.new('basic')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end

#update_inventory(body, domain, v2_ext, product_id) ⇒ ApiResponse

Update an existing product inventory. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | warehouse_id | Required | - | Numeric | The warehouse id for product. | | quantity | Required | | Numeric | This is the current quantity (initial excludes shipped) | | name | Optional | - | String | This is the name of the product. It should be max 255 character. | | description | Optional | - | String | This is the description of the product. It should be max 1000 character. | | initial_quantity | Optional | - | Numeric | This is the initially entered quantity for product inventory. | | inventory_threshold | Optional | - | Numeric | Quantity in which we should initiate events (reorder etc…) | | reorder_amount | Optional | - | Numeric | Reorder amount is the amount we need to request to reorder. | **Response Data** Response parameters contained within the ‘data` field object: | Parameter | Type | Description | | — | — | — | | id | int | This is the ID for the related inventory. | | product_id | int | This is the product id of the related inventory. | | quantity | int | This is the current quantity (initial excludes shipped) | | allocated_quantity | int | This is the purchased quantity but not shipped yet. (after shipping item quantity gets decremented) | | product_name | string | This is the name of the product. | | sku | string | The product SKU identifier. | | warehouse_info | json | Warehouse object related to inventory. (Warehouse id and name will be inside of this object) | description here here

Parameters:

  • body (UpdateInventoryRequest)

    Required parameter: TODO: type

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

  • product_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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
# File 'lib/sticky_io_restful_api_v2025731/controllers/inventories_controller.rb', line 130

def update_inventory(body,
                     domain,
                     v2_ext,
                     product_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PUT,
                                 '/.{domain}{v2_ext}products/{product_id}/inventory',
                                 Server::SERVER_1)
               .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; charset=utf-8', key: 'content-type'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('basic')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end

#update_variant_inventory(body, domain, v2_ext, product_id, variant_id) ⇒ ApiResponse

Update an existing product inventory. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | warehouse_id | Required | - | Numeric | The warehouse id for product. | | quantity | Required | - | Numeric | This is the current quantity (initial excludes shipped) | | name | Optional | - | String | The name of product. | | description | Optional | - | String | The description of product. | | initial_quantity | Optional | - | Numeric | The initially entered quantity. | | inventory_threshold | Optional | - | Numeric | Quantity in which we should initiate events (reorder etc…) | | reorder_amount | Optional | - | Numeric | Reorder amount is the amount we need to request to reorder. | **Response Data** Response parameters contained within the ‘data` field object: | Parameter | Type | Description | | — | — | — | | id | int | This is the ID for the related inventory. | | product_id | int | This is the product_id of the related inventory. | | quantity | int | This is the current quantity (initial excludes shipped) | | allocated_quantity | int | This is the purchased quantity but not shipped yet. (after shipping item quantity gets decremented) | | product_name | string | This is the name of the product. | | sku | string | The product SKU identifier. | | warehouse_info | json | Warehouse object related to inventory. (Warehouse id and name will be inside of this object) | description here here here

Parameters:

  • body (UpdateVariantInventoryRequest)

    Required parameter: TODO: type

  • domain (String)

    Required parameter: TODO: type description here

  • v2_ext (String)

    Required parameter: TODO: type description here

  • product_id (String)

    Required parameter: TODO: type description

  • variant_id (String)

    Required parameter: TODO: type description

Returns:

  • (ApiResponse)

    Complete http response with raw body and status code.



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/sticky_io_restful_api_v2025731/controllers/inventories_controller.rb', line 197

def update_variant_inventory(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}/inventory',
                                 Server::SERVER_1)
               .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; charset=utf-8', key: 'content-type'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('basic')))
    .response(new_response_handler
                .is_response_void(true)
                .is_api_response(true))
    .execute
end