Class: Merge::Ats::ScopesClient

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_ruby_client/ats/scopes/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_client:) ⇒ Merge::Ats::ScopesClient

Parameters:



16
17
18
# File 'lib/merge_ruby_client/ats/scopes/client.rb', line 16

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientMerge::RequestClient (readonly)



12
13
14
# File 'lib/merge_ruby_client/ats/scopes/client.rb', line 12

def request_client
  @request_client
end

Instance Method Details

#default_scopes_retrieve(request_options: nil) ⇒ Merge::Ats::CommonModelScopeApi

Get the default permissions for Merge Common Models and fields across all Linked

Accounts of a given category. [Learn
more](https://help.merge.dev/en/articles/8828211-common-model-and-field-scopes).

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.scopes.default_scopes_retrieve

Parameters:

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/merge_ruby_client/ats/scopes/client.rb', line 33

def default_scopes_retrieve(request_options: nil)
  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)}/ats/v1/default-scopes"
  end
  Merge::Ats::CommonModelScopeApi.from_json(json_object: response.body)
end

#linked_account_scopes_create(common_models:, request_options: nil) ⇒ Merge::Ats::CommonModelScopeApi

Update permissions for any Common Model or field for a single Linked Account.

Any Scopes not set in this POST request will inherit the default Scopes. [Learn
more](https://help.merge.dev/en/articles/8828211-common-model-and-field-scopes)

Examples:

api = Merge::Client.new(
  base_url: "https://api.example.com",
  environment: Merge::Environment::PRODUCTION,
  api_key: "YOUR_AUTH_TOKEN"
)
api.ats.scopes.(common_models: [{ model_name: "Employee", model_permissions: { "READ": { is_enabled: true }, "WRITE": { is_enabled: false } } }, { model_name: "Benefit", model_permissions: { "WRITE": { is_enabled: false } } }])

Parameters:

  • common_models (Array<Hash>)

    The common models you want to update the scopes forRequest of type Array<Merge::Ats::IndividualCommonModelScopeDeserializerRequest>, as a Hash

    • :model_name (String)

    • :model_permissions (Hash=> Merge::Ats::ModelPermissionDeserializerRequest)

    • :field_permissions (Hash)

      • :enabled (Array<Object>)

      • :disabled (Array<Object>)

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

Returns:



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/merge_ruby_client/ats/scopes/client.rb', line 107

def (common_models:, request_options: nil)
  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
    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 || {}), common_models: common_models }.compact
    req.url "#{@request_client.get_url(request_options: request_options)}/ats/v1/linked-account-scopes"
  end
  Merge::Ats::CommonModelScopeApi.from_json(json_object: response.body)
end

#linked_account_scopes_retrieve(request_options: nil) ⇒ Merge::Ats::CommonModelScopeApi

Get all available permissions for Merge Common Models and fields for a single

Linked Account. [Learn
more](https://help.merge.dev/en/articles/8828211-common-model-and-field-scopes).

Examples:

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

Parameters:

Returns:



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/merge_ruby_client/ats/scopes/client.rb', line 67

def (request_options: nil)
  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)}/ats/v1/linked-account-scopes"
  end
  Merge::Ats::CommonModelScopeApi.from_json(json_object: response.body)
end