Class: StickyIoRestfulApiV2025731::CustomFieldsController
- Inherits:
-
BaseController
- Object
- BaseController
- StickyIoRestfulApiV2025731::CustomFieldsController
- Defined in:
- lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb
Overview
CustomFieldsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#add_custom_field_values(body, domain, v2_ext, order_id) ⇒ ApiResponse
Attach an existing orders’ custom fields and assign values for them to the order.
-
#add_option_to_custom_field(body, domain, v2_ext, custom_field_id) ⇒ ApiResponse
Add an option to an existing custom field’s option list.
-
#create_custom_field(body, domain, v2_ext) ⇒ ApiResponse
Create a new custom field **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | - | - | - | - | - | | id | Required | - | Integer | The custom field ID.
-
#delete_custom_field(domain, v2_ext, custom_field_id) ⇒ ApiResponse
Delete an existing custom field here.
-
#delete_custom_field_values(domain, v2_ext, order_id, custom_field_id) ⇒ ApiResponse
Delete an existing custom field from the list attached to the order here.
-
#delete_option_from_custom_field(domain, v2_ext, custom_field_id, option_id) ⇒ ApiResponse
Delete an existing option from custom field’s option list here here.
-
#get_all_custom_fields(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all custom fields **Response Data**\ Response parameters expected in custom field object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field ID.
-
#get_field_types(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all custom field’s field types **Response Data**\ Response parameters expected in custom field’s field type object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field’s field type ID.
-
#get_options_for_custom_field(domain, v2_ext, custom_field_id) ⇒ ApiResponse
Fetch a list of all options attached to requested custom field ID **Response Data**\ Response parameters expected in custom field’s field type object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The option ID.
-
#get_order_custom_fields(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all custom fields created for orders **Response Data**\ Response parameters expected in custom field object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field ID.
-
#get_single_custom_field(domain, v2_ext, custom_field_id) ⇒ ApiResponse
Fetch a single coupon profile **Response Data**\ Response parameters expected in custom field object contained within the ‘data` field object: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field ID.
-
#get_types(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all custom field’s types **Response Data**\ Response parameters expected in custom field’s type object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field’s type ID.
-
#update_custom_field(platform_key, body, domain, v2_ext, custom_field_id) ⇒ ApiResponse
Update an existing custom field.
-
#update_custom_field_values(body, domain, v2_ext, order_id) ⇒ ApiResponse
Update custom fields list that attached to the order.
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
#add_custom_field_values(body, domain, v2_ext, order_id) ⇒ ApiResponse
Attach an existing orders’ custom fields and assign values for them to the order. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | custom_fields | Required | - | Array | Array of custom fields. | | custom_fields.*.id | Required | - | Integer | The custom field ID. | | custom_fields.*.value | Required | - | String/Boolean | The custom field desired value. In Boolean field type the value can be either 1/0 or true/false. | parameter: TODO: type description here
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 429 def add_custom_field_values(body, domain, v2_ext, order_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}orders/{order_id}/custom_fields', 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(order_id, key: 'order_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(AddCustomFieldValuesMulti.method(:from_hash)) .is_api_response(true)) .execute end |
#add_option_to_custom_field(body, domain, v2_ext, custom_field_id) ⇒ ApiResponse
Add an option to an existing custom field’s option list. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | - | - | - | - | - | | value | Required | - | String | The option name. description here here
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 318 def add_option_to_custom_field(body, domain, v2_ext, custom_field_id) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}custom_fields/{custom_field_id}/options', 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(custom_field_id, key: 'custom_field_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(AddOptionToField.method(:from_hash)) .is_api_response(true)) .execute end |
#create_custom_field(body, domain, v2_ext) ⇒ ApiResponse
Create a new custom field **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | - | - | - | - | - | | id | Required | - | Integer | The custom field ID. | field_type_id | Required | - | Integer | The custom field’s field type ID. (relates to input type: text, multi, date, range, etc.) | name | Required | - | String | The custom field display name. Max length of 100 Characters. Accepted values are letters, numbers, spaces, underscores, and dashes. The name must start with a letter. | token_key | Required | - | String | The custom field email token field. Token key to reference the custom field in email templates. Max length of 100 Characters. Can be a combination of letters, numbers, underscores and dashes. The token_key must start with a letter. Once created, the token_key can not be edited/updated | is_multi | Required | - | Integer Flag | Allow for multiple options to be selected. | options | Required Sometimes | - | Array | Array of options associated with the custom field. Required if field type is ‘Enumeration`. | options.* | Required | - | String | The option name. | type_id | Required | - | Integer | The custom field’s type ID. Relates to the entity type. ie 2 for orders description here
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 177 def create_custom_field(body, domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::POST, '/.{domain}{v2_ext}custom_fields', 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)) .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(CreateCustomField.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_custom_field(domain, v2_ext, custom_field_id) ⇒ ApiResponse
Delete an existing custom field here
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 354 def delete_custom_field(domain, v2_ext, custom_field_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}custom_fields/{custom_field_id}', 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(custom_field_id, key: 'custom_field_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 |
#delete_custom_field_values(domain, v2_ext, order_id, custom_field_id) ⇒ ApiResponse
Delete an existing custom field from the list attached to the order here
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 512 def delete_custom_field_values(domain, v2_ext, order_id, custom_field_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}orders/{order_id}/custom_fields/{custom_field_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(order_id, key: 'order_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(custom_field_id, key: 'custom_field_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(DeleteCustomFieldValues.method(:from_hash)) .is_api_response(true)) .execute end |
#delete_option_from_custom_field(domain, v2_ext, custom_field_id, option_id) ⇒ ApiResponse
Delete an existing option from custom field’s option list here here
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 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 385 def delete_option_from_custom_field(domain, v2_ext, custom_field_id, option_id) @api_call .request(new_request_builder(HttpMethodEnum::DELETE, '/.{domain}{v2_ext}custom_fields/{custom_field_id}/options/{option_id}', 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(custom_field_id, key: 'custom_field_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(option_id, key: 'option_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_all_custom_fields(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all custom fields **Response Data**\ Response parameters expected in custom field object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field ID. | field_type_id | Integer | The custom field’s field type ID. | name | String | The custom field name. | token_key | String | The custom field email token field. | is_multi | Integer Flag | Allow for multiple options to be selected. | options | Array | Array of option objects associated with the custom field. | options.*.id | Integer | The option ID. | options.*.value | String | The option value. | type_id | Integer | The custom field’s type ID.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 28 def get_all_custom_fields(domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}custom_fields', 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)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetSingleCustomField.method(:from_hash)) .is_api_response(true)) .execute end |
#get_field_types(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all custom field’s field types **Response Data**\ Response parameters expected in custom field’s field type object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field’s field type ID. | name | String | The custom field’s field name.
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 246 def get_field_types(domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}custom_fields/field_types', 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)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetFieldTypes.method(:from_hash)) .is_api_response(true)) .execute end |
#get_options_for_custom_field(domain, v2_ext, custom_field_id) ⇒ ApiResponse
Fetch a list of all options attached to requested custom field ID **Response Data**\ Response parameters expected in custom field’s field type object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The option ID. | name | String | The option name. here
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 280 def (domain, v2_ext, custom_field_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}custom_fields/{custom_field_id}/options', 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(custom_field_id, key: 'custom_field_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(GetOptionsForCustomField.method(:from_hash)) .is_api_response(true)) .execute end |
#get_order_custom_fields(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all custom fields created for orders **Response Data**\ Response parameters expected in custom field object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field ID. | field_type_id | Integer | The custom field’s field type ID. | name | String | The custom field name. | token_key | String | The custom field email token field. | is_multi | Integer Flag | Allow for multiple options to be selected. | options | Array | Array of option objects associated with the custom field. | options.*.id | Integer | The option ID. | options.*.value | String | The option value. | type_id | Integer | The custom field’s type ID.
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 561 def get_order_custom_fields(domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}custom_fields/orders', 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_single_custom_field(domain, v2_ext, custom_field_id) ⇒ ApiResponse
Fetch a single coupon profile **Response Data**\ Response parameters expected in custom field object contained within the ‘data` field object: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field ID. | field_type_id | Integer | The custom field’s field type ID. | name | String | The custom field name. | token_key | String | The custom field email token field. | is_multi | Integer Flag | Allow for multiple options to be selected. | options | Array | Array of option objects associated with the custom field. | options.*.id | Integer | The option ID. | options.*.value | String | The option value. | type_id | Integer | The custom field’s type ID. here
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 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 71 def get_single_custom_field(domain, v2_ext, custom_field_id) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}custom_fields/{custom_field_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(custom_field_id, key: 'custom_field_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(GetSingleCustomField.method(:from_hash)) .is_api_response(true)) .execute end |
#get_types(domain, v2_ext) ⇒ ApiResponse
Fetch a list of all custom field’s types **Response Data**\ Response parameters expected in custom field’s type object contained within the ‘data` field array: | Field | Data Type | Description | - | - | - | | id | Integer | The custom field’s type ID. | name | String | The custom field’s name.
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 214 def get_types(domain, v2_ext) @api_call .request(new_request_builder(HttpMethodEnum::GET, '/.{domain}{v2_ext}custom_fields/types', 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)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('basic'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(GetTypesGetTypes.method(:from_hash)) .is_api_response(true)) .execute end |
#update_custom_field(platform_key, body, domain, v2_ext, custom_field_id) ⇒ ApiResponse
Update an existing custom field. **Request Data**\ Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | - | - | - | - | - | | name | Required | - | String | The custom field name. Accepted values are letters, numbers, spaces, underscores, and dashes. | options | Required Sometimes | - | Array | Array of option objects associated with the custom field. Required if field type is Enumeration. | options.* | Optional | - | String | The option name. here description here here
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 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 116 def update_custom_field(platform_key, body, domain, v2_ext, custom_field_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}custom_fields/{custom_field_id}', Server::SERVER_1) .header_param(new_parameter(platform_key, key: 'Platform-Key') .is_required(true)) .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(custom_field_id, key: 'custom_field_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(UpdateCustomField.method(:from_hash)) .is_api_response(true)) .execute end |
#update_custom_field_values(body, domain, v2_ext, order_id) ⇒ ApiResponse
Update custom fields list that attached to the order. **Request Data** Request parameters expected during this API call: | Field | Requirement | Default | Data Type | Description | | — | — | — | — | — | | custom_fields | Required | - | Array | Array of custom fields. | | custom_fields.*.id | Required | - | Integer | The custom field ID. | | custom_fields.*.value | Required | - | String/Boolean | The custom field desired value. In Boolean field type the value can be either 1/0 or true/false. | Required parameter: TODO: type description here
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
# File 'lib/sticky_io_restful_api_v2025731/controllers/custom_fields_controller.rb', line 475 def update_custom_field_values(body, domain, v2_ext, order_id) @api_call .request(new_request_builder(HttpMethodEnum::PUT, '/.{domain}{v2_ext}orders/{order_id}/custom_fields', 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(order_id, key: 'order_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(UpdateCustomFieldValues.method(:from_hash)) .is_api_response(true)) .execute end |