Class: NewStoreApi::SegmentationController

Inherits:
BaseController show all
Defined in:
lib/new_store_api/controllers/segmentation_controller.rb

Overview

SegmentationController

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

Constructor Details

This class inherits a constructor from NewStoreApi::BaseController

Instance Method Details

#create_import(body) ⇒ ImportResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Creates a new segmentation import from an S3 URI CSV. description here

Parameters:

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 46

def create_import(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/customer/imports',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ImportResponse.method(:from_hash)))
    .execute
end

#create_presigned_url(body) ⇒ PresignedUrlResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Generates a presigned URL that will allow the upload of a CSV file to be used in an import. description here

Parameters:

Returns:



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 207

def create_presigned_url(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/customer/imports/presigned-urls',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(PresignedUrlResponse.method(:from_hash)))
    .execute
end

#create_segmentation_tags_operations(tag_id, body, operation: OperationEnum::ASSIGN) ⇒ void

This method returns an undefined value.

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
There are two possible operations: - **assign** - Assigns the tag with `tag_id` to the provided list of profiles. - **unassign** - Unassigns a list of profiles from the tag with `tag_id`. description here operation that will be performed. By default it's **assign**.

Parameters:

  • tag_id (String)

    Required parameter: TODO: type description here

  • body (OperationTagsRequest)

    Required parameter: TODO: type

  • operation (OperationEnum) (defaults to: OperationEnum::ASSIGN)

    Optional parameter: The segmentation tag



466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 466

def create_segmentation_tags_operations(tag_id,
                                        body,
                                        operation: OperationEnum::ASSIGN)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/customer/tags/{tag_id}/profiles',
                                 Server::API)
               .template_param(new_parameter(tag_id, key: 'tag_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .query_param(new_parameter(operation, key: 'operation'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#create_tag(body) ⇒ TagResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Creates a new segmentation tag. here

Parameters:

Returns:



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 309

def create_tag(body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::POST,
                                 '/customer/tags',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TagResponse.method(:from_hash)))
    .execute
end

#destroy_import(import_id) ⇒ void

This method returns an undefined value.

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Deletes the segmentation import and all associated tags for the given `import_id`. here

Parameters:

  • import_id (String)

    Required parameter: TODO: type description



76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 76

def destroy_import(import_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/customer/imports/{import_id}',
                                 Server::API)
               .template_param(new_parameter(import_id, key: 'import_id')
                                .should_encode(true))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#destroy_tag(tag_id) ⇒ void

This method returns an undefined value.

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Deletes data entry for the given `tag_id`.

Parameters:

  • tag_id (String)

    Required parameter: TODO: type description here



337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 337

def destroy_tag(tag_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::DELETE,
                                 '/customer/tags/{tag_id}',
                                 Server::API)
               .template_param(new_parameter(tag_id, key: 'tag_id')
                                .should_encode(true))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .is_response_void(true))
    .execute
end

#list_import_tags(import_id, limit: 10, offset: 0, order_by: nil, desc: false) ⇒ ListImportTags

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Lists tags for a given import here the results. the ordering.

Parameters:

  • import_id (String)

    Required parameter: TODO: type description

  • limit (Integer) (defaults to: 10)

    Optional parameter: The number of requested tags.

  • offset (Integer) (defaults to: 0)

    Optional parameter: The tags page offset.

  • order_by (OrderByEnum) (defaults to: nil)

    Optional parameter: The field used to order

  • desc (TrueClass | FalseClass) (defaults to: false)

    Optional parameter: The direction of

Returns:



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 170

def list_import_tags(import_id,
                     limit: 10,
                     offset: 0,
                     order_by: nil,
                     desc: false)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/imports/{import_id}/tags',
                                 Server::API)
               .template_param(new_parameter(import_id, key: 'import_id')
                                .should_encode(true))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(order_by, key: 'order_by'))
               .query_param(new_parameter(desc, key: 'desc'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ListImportTags.method(:from_hash)))
    .execute
end

#list_importsListImportsResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Returns a list of segmentation imports.

Returns:



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 20

def list_imports
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/imports',
                                 Server::API)
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ListImportsResponse.method(:from_hash)))
    .execute
end

#list_profile_tags(profile_id, limit: 10, offset: 0, order_by: OrderBy1Enum::UPDATED_AT) ⇒ ListTagsResponse

Returns a list of segmentation tags associated to the given profile_id. customer profiles. offset. the results. Ascending order will be applied for the field provided.

Parameters:

  • profile_id (String)

    Required parameter: Profile ID

  • limit (Integer) (defaults to: 10)

    Optional parameter: The number of requested

  • offset (Integer) (defaults to: 0)

    Optional parameter: The customer profiles page

  • order_by (OrderBy1Enum) (defaults to: OrderBy1Enum::UPDATED_AT)

    Optional parameter: The field used to order

Returns:



232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 232

def list_profile_tags(profile_id,
                      limit: 10,
                      offset: 0,
                      order_by: OrderBy1Enum::UPDATED_AT)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/profiles/{profile_id}/tags',
                                 Server::API)
               .template_param(new_parameter(profile_id, key: 'profile_id')
                                .should_encode(true))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(order_by, key: 'order_by'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ListTagsResponse.method(:from_hash)))
    .execute
end

#list_tag_profiles(tag_id, limit: 10, offset: 0) ⇒ ListTagProfilesResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Returns a list of profiles associated to the given `tag_id`. here customer profiles. offset.

Parameters:

  • tag_id (Array[String])

    Required parameter: TODO: type description

  • limit (Integer) (defaults to: 10)

    Optional parameter: The number of requested

  • offset (Integer) (defaults to: 0)

    Optional parameter: The customer profiles page

Returns:



427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 427

def list_tag_profiles(tag_id,
                      limit: 10,
                      offset: 0)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/tags/{tag_id}/profiles',
                                 Server::API)
               .template_param(new_parameter(tag_id, key: 'tag_id')
                                .should_encode(true))
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(offset, key: 'offset'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ListTagProfilesResponse.method(:from_hash)))
    .execute
end

#list_tags(limit: 10, offset: 0, order_by: OrderBy1Enum::UPDATED_AT, store_id: nil, is_import_enabled: nil) ⇒ ListTagsResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Returns a list of segmentation tags. the results. Ascending order will be applied for the field provided. the store ID. The response will return only store specific tags. that have associated imports that are enabled for a store. A store_id must be provided. The offset and limit fields must not be present. The entire data is returned.

Parameters:

  • limit (Integer) (defaults to: 10)

    Optional parameter: The number of requested tags.

  • offset (Integer) (defaults to: 0)

    Optional parameter: The tags page offset.

  • order_by (OrderBy1Enum) (defaults to: OrderBy1Enum::UPDATED_AT)

    Optional parameter: The field used to order

  • store_id (String) (defaults to: nil)

    Optional parameter: To filter the tags based on

  • is_import_enabled (String) (defaults to: nil)

    Optional parameter: Returns all the tags

Returns:



274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 274

def list_tags(limit: 10,
              offset: 0,
              order_by: OrderBy1Enum::UPDATED_AT,
              store_id: nil,
              is_import_enabled: nil)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/tags',
                                 Server::API)
               .query_param(new_parameter(limit, key: 'limit'))
               .query_param(new_parameter(offset, key: 'offset'))
               .query_param(new_parameter(order_by, key: 'order_by'))
               .query_param(new_parameter(store_id, key: 'store_id'))
               .query_param(new_parameter(is_import_enabled, key: 'is_import_enabled'))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ListTagsResponse.method(:from_hash)))
    .execute
end

#show_import(import_id) ⇒ ImportResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Returns a single segmentation import for the given `import_id`. here

Parameters:

  • import_id (String)

    Required parameter: TODO: type description

Returns:



102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 102

def show_import(import_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/imports/{import_id}',
                                 Server::API)
               .template_param(new_parameter(import_id, key: 'import_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ImportResponse.method(:from_hash)))
    .execute
end

#show_tag(tag_id) ⇒ TagResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Returns a single segmentation tag for the given customer `tag_id`.

Parameters:

  • tag_id (String)

    Required parameter: TODO: type description here

Returns:



362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 362

def show_tag(tag_id)
  @api_call
    .request(new_request_builder(HttpMethodEnum::GET,
                                 '/customer/tags/{tag_id}',
                                 Server::API)
               .template_param(new_parameter(tag_id, key: 'tag_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'accept'))
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TagResponse.method(:from_hash)))
    .execute
end

#update_import(import_id, body) ⇒ ImportResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Updates an existing segmentation import. here description here

Parameters:

  • import_id (String)

    Required parameter: TODO: type description

  • body (PatchImportRequest)

    Required parameter: TODO: type

Returns:



132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 132

def update_import(import_id,
                  body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/customer/imports/{import_id}',
                                 Server::API)
               .template_param(new_parameter(import_id, key: 'import_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(ImportResponse.method(:from_hash)))
    .execute
end

#update_tag(tag_id, body) ⇒ TagResponse

🚧 BETA: This endpoint is in beta and may change.
See API Lifecycle Documentation for details.
Updates an existing segmentation tag for the given `tag_id`. here

Parameters:

  • tag_id (String)

    Required parameter: TODO: type description here

  • body (UpdateTagRequest)

    Required parameter: TODO: type description

Returns:



391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/new_store_api/controllers/segmentation_controller.rb', line 391

def update_tag(tag_id,
               body)
  @api_call
    .request(new_request_builder(HttpMethodEnum::PATCH,
                                 '/customer/tags/{tag_id}',
                                 Server::API)
               .template_param(new_parameter(tag_id, key: 'tag_id')
                                .should_encode(true))
               .header_param(new_parameter('application/json', key: 'Content-Type'))
               .body_param(new_parameter(body))
               .header_param(new_parameter('application/json', key: 'accept'))
               .body_serializer(proc do |param| param.to_json unless param.nil? end)
               .auth(Single.new('oauth')))
    .response(new_response_handler
                .deserializer(APIHelper.method(:custom_type_deserializer))
                .deserialize_into(TagResponse.method(:from_hash)))
    .execute
end