Class: CDP::Persistency

Inherits:
Object
  • Object
show all
Extended by:
Retryable, Configuration
Defined in:
lib/cdp/persistency.rb

Constant Summary

Constants included from Configuration

Configuration::CDP_CORE_SERVICE_URL

Constants included from Retryable

Retryable::CDP_CLIENT_RETRYABLE_ERRORS, Retryable::DEFAULT_CDP_CLIENT_RETRYABLE_ERRORS

Class Method Summary collapse

Methods included from Retryable

retry_block

Class Method Details

.clientObject



23
24
25
# File 'lib/cdp/persistency.rb', line 23

def client
  @client ||= default_client
end

.client=(client) ⇒ Object



27
28
29
# File 'lib/cdp/persistency.rb', line 27

def client=(client)
  @client = client
end

.execute(requests:, retries: 3) ⇒ Object

Raises:

  • (ArgumentError)


15
16
17
18
19
20
21
# File 'lib/cdp/persistency.rb', line 15

def execute(requests:, retries: 3)
  raise ArgumentError, 'requests should be an Array' unless requests.is_a?(Array)

  response = retry_block(limit: retries) {
    client.execute(requests)
  }
end

.new(tenant_id:) ⇒ Object



10
11
12
13
# File 'lib/cdp/persistency.rb', line 10

def new(tenant_id:)
  schema = get_schema(tenant_id)
  CDP::Builder.new(tenant_id: tenant_id, schema: schema)
end