Class: Merge::Ticketing::AsyncScopesClient

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Parameters:



133
134
135
# File 'lib/merge_ruby_client/ticketing/scopes/client.rb', line 133

def initialize(request_client:)
  @request_client = request_client
end

Instance Attribute Details

#request_clientMerge::AsyncRequestClient (readonly)



129
130
131
# File 'lib/merge_ruby_client/ticketing/scopes/client.rb', line 129

def request_client
  @request_client
end

Instance Method Details

#default_scopes_retrieve(request_options: nil) ⇒ Merge::Ticketing::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.ticketing.scopes.default_scopes_retrieve

Parameters:

Returns:



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/merge_ruby_client/ticketing/scopes/client.rb', line 150

def default_scopes_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/default-scopes"
    end
    Merge::Ticketing::CommonModelScopeApi.from_json(json_object: response.body)
  end
end

#linked_account_scopes_create(common_models:, request_options: nil) ⇒ Merge::Ticketing::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.ticketing.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::Ticketing::IndividualCommonModelScopeDeserializerRequest>, as a Hash

    • :model_name (String)

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

    • :field_permissions (Hash)

      • :enabled (Array<Object>)

      • :disabled (Array<Object>)

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

Returns:



228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/merge_ruby_client/ticketing/scopes/client.rb', line 228

def (common_models:, 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
      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)}/ticketing/v1/linked-account-scopes"
    end
    Merge::Ticketing::CommonModelScopeApi.from_json(json_object: response.body)
  end
end

#linked_account_scopes_retrieve(request_options: nil) ⇒ Merge::Ticketing::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.ticketing.scopes.

Parameters:

Returns:



186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/merge_ruby_client/ticketing/scopes/client.rb', line 186

def (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/linked-account-scopes"
    end
    Merge::Ticketing::CommonModelScopeApi.from_json(json_object: response.body)
  end
end