Class: Merge::Ticketing::AsyncFieldMappingClient

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ticketing/field_mapping/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ Merge::Ticketing::AsyncFieldMappingClient

Parameters:



285
286
287
# File 'lib/merge_ruby_client/ticketing/field_mapping/client.rb', line 285

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientMerge::AsyncRequestClient (readonly)



281
282
283
# File 'lib/merge_ruby_client/ticketing/field_mapping/client.rb', line 281

def request_client
  @request_client
end

Instance Method Details

#field_mappings_create(target_field_name:, target_field_description:, remote_field_traversal_path:, remote_method:, remote_url_path:, common_model_name:, exclude_remote_field_metadata: nil, request_options: nil) ⇒ Merge::Ticketing::FieldMappingInstanceResponse

Create new Field Mappings that will be available after the next scheduled sync.

This will cause the next sync for this Linked Account to sync **ALL** data from
start.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ticketing.field_mapping.field_mappings_create(
  target_field_name: "example_target_field_name",
  target_field_description: "this is a example description of the target field",
  remote_field_traversal_path: ["example_remote_field"],
  remote_method: "GET",
  remote_url_path: "/example-url-path",
  common_model_name: "ExampleCommonModel"
)

Parameters:

  • exclude_remote_field_metadata (Boolean) (defaults to: nil)

    If ‘true`, remote fields metadata is excluded from each field mapping instance (i.e. `remote_fields.remote_key_name` and `remote_fields.schema` will be null). This will increase the speed of the request since these fields require some calculations.

  • target_field_name (String)

    The name of the target field you want this remote field to map to.

  • target_field_description (String)

    The description of the target field you want this remote field to map to.

  • remote_field_traversal_path (Array<Object>)

    The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint.

  • remote_method (String)

    The method of the remote endpoint where the remote field is coming from.

  • remote_url_path (String)

    The path of the remote endpoint where the remote field is coming from.

  • common_model_name (String)

    The name of the Common Model that the remote field corresponds to in a given category.

  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/merge_ruby_client/ticketing/field_mapping/client.rb', line 362

def field_mappings_create(target_field_name:, target_field_description:, remote_field_traversal_path:,
                          remote_method:, remote_url_path:, common_model_name:, exclude_remote_field_metadata: nil, request_options: nil)
  Async do
    response = @request_client.conn.post do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "exclude_remote_field_metadata": 
      }.compact
      req.body = {
        **(request_options&.additional_body_parameters || {}),
        target_field_name: target_field_name,
        target_field_description: target_field_description,
        remote_field_traversal_path: remote_field_traversal_path,
        remote_method: remote_method,
        remote_url_path: remote_url_path,
        common_model_name: common_model_name
      }.compact
      req.url "#{@request_client.get_url(request_options: request_options)}/ticketing/v1/field-mappings"
    end
    Merge::Ticketing::FieldMappingInstanceResponse.from_json(json_object: response.body)
  end
end

#field_mappings_destroy(field_mapping_id:, request_options: nil) ⇒ Merge::Ticketing::FieldMappingInstanceResponse

Deletes Field Mappings for a Linked Account. All data related to this Field

Mapping will be deleted and these changes will be reflected after the next
scheduled sync. This will cause the next sync for this Linked Account to sync
**ALL** data from start.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ticketing.field_mapping.field_mappings_destroy(field_mapping_id: "field_mapping_id")

Parameters:

Returns:



408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/merge_ruby_client/ticketing/field_mapping/client.rb', line 408

def field_mappings_destroy(field_mapping_id:, request_options: nil)
  Async do
    response = @request_client.conn.delete do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      unless request_options.nil? || request_options&.additional_query_parameters.nil?
        req.params = { **(request_options&.additional_query_parameters || {}) }.compact
      end
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/ticketing/v1/field-mappings/#{field_mapping_id}"
    end
    Merge::Ticketing::FieldMappingInstanceResponse.from_json(json_object: response.body)
  end
end

#field_mappings_partial_update(field_mapping_id:, remote_field_traversal_path: nil, remote_method: nil, remote_url_path: nil, request_options: nil) ⇒ Merge::Ticketing::FieldMappingInstanceResponse

Create or update existing Field Mappings for a Linked Account. Changes will be

reflected after the next scheduled sync. This will cause the next sync for this
Linked Account to sync **ALL** data from start.

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ticketing.field_mapping.field_mappings_partial_update(field_mapping_id: "field_mapping_id")

Parameters:

  • field_mapping_id (String)
  • remote_field_traversal_path (Array<Object>) (defaults to: nil)

    The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint.

  • remote_method (String) (defaults to: nil)

    The method of the remote endpoint where the remote field is coming from.

  • remote_url_path (String) (defaults to: nil)

    The path of the remote endpoint where the remote field is coming from.

  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
# File 'lib/merge_ruby_client/ticketing/field_mapping/client.rb', line 449

def field_mappings_partial_update(field_mapping_id:, remote_field_traversal_path: nil, remote_method: nil,
                                  remote_url_path: nil, request_options: nil)
  Async do
    response = @request_client.conn.patch do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      unless request_options.nil? || request_options&.additional_query_parameters.nil?
        req.params = { **(request_options&.additional_query_parameters || {}) }.compact
      end
      req.body = {
        **(request_options&.additional_body_parameters || {}),
        remote_field_traversal_path: remote_field_traversal_path,
        remote_method: remote_method,
        remote_url_path: remote_url_path
      }.compact
      req.url "#{@request_client.get_url(request_options: request_options)}/ticketing/v1/field-mappings/#{field_mapping_id}"
    end
    Merge::Ticketing::FieldMappingInstanceResponse.from_json(json_object: response.body)
  end
end

#field_mappings_retrieve(exclude_remote_field_metadata: nil, request_options: nil) ⇒ Merge::Ticketing::FieldMappingApiInstanceResponse

Get all Field Mappings for this Linked Account. Field Mappings are mappings

between third-party Remote Fields and user defined Merge fields. [Learn
more](https://docs.merge.dev/supplemental-data/field-mappings/overview/).

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ticketing.field_mapping.field_mappings_retrieve

Parameters:

  • exclude_remote_field_metadata (Boolean) (defaults to: nil)

    If ‘true`, remote fields metadata is excluded from each field mapping instance (i.e. `remote_fields.remote_key_name` and `remote_fields.schema` will be null). This will increase the speed of the request since these fields require some calculations.

  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/merge_ruby_client/ticketing/field_mapping/client.rb', line 306

def field_mappings_retrieve(exclude_remote_field_metadata: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "exclude_remote_field_metadata": 
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/ticketing/v1/field-mappings"
    end
    Merge::Ticketing::FieldMappingApiInstanceResponse.from_json(json_object: response.body)
  end
end

#remote_fields_retrieve(common_models: nil, include_example_values: nil, request_options: nil) ⇒ Merge::Ticketing::RemoteFieldApiResponse

Get all remote fields for a Linked Account. Remote fields are third-party fields

that are accessible after initial sync if remote_data is enabled. You can use
remote fields to override existing Merge fields or map a new Merge field. [Learn
more](https://docs.merge.dev/supplemental-data/field-mappings/overview/).

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ticketing.field_mapping.remote_fields_retrieve

Parameters:

  • common_models (String) (defaults to: nil)

    A comma seperated list of Common Model names. If included, will only return Remote Fields for those Common Models.

  • include_example_values (String) (defaults to: nil)

    If true, will include example values, where available, for remote fields in the 3rd party platform. These examples come from active data from your customers.

  • request_options (Merge::RequestOptions) (defaults to: nil)

Returns:



494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
# File 'lib/merge_ruby_client/ticketing/field_mapping/client.rb', line 494

def remote_fields_retrieve(common_models: nil, include_example_values: nil, request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      req.params = {
        **(request_options&.additional_query_parameters || {}),
        "common_models": common_models,
        "include_example_values": include_example_values
      }.compact
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/ticketing/v1/remote-fields"
    end
    Merge::Ticketing::RemoteFieldApiResponse.from_json(json_object: response.body)
  end
end

#target_fields_retrieve(request_options: nil) ⇒ Merge::Ticketing::ExternalTargetFieldApiResponse

Get all organization-wide Target Fields, this will not include any Linked

Account specific Target Fields. Organization-wide Target Fields are additional
fields appended to the Merge Common Model for all Linked Accounts in a category.
[Learn
more](https://docs.merge.dev/supplemental-data/field-mappings/target-fields/).

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ticketing.field_mapping.target_fields_retrieve

Parameters:

Returns:



534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
# File 'lib/merge_ruby_client/ticketing/field_mapping/client.rb', line 534

def target_fields_retrieve(request_options: nil)
  Async do
    response = @request_client.conn.get do |req|
      req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
      req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
      req.headers["X-Account-Token"] = request_options. unless request_options&..nil?
      req.headers = {
    **(req.headers || {}),
    **@request_client.get_headers,
    **(request_options&.additional_headers || {})
      }.compact
      unless request_options.nil? || request_options&.additional_query_parameters.nil?
        req.params = { **(request_options&.additional_query_parameters || {}) }.compact
      end
      unless request_options.nil? || request_options&.additional_body_parameters.nil?
        req.body = { **(request_options&.additional_body_parameters || {}) }.compact
      end
      req.url "#{@request_client.get_url(request_options: request_options)}/ticketing/v1/target-fields"
    end
    Merge::Ticketing::ExternalTargetFieldApiResponse.from_json(json_object: response.body)
  end
end