Module: ElephantInTheRoom::TheOneApiSdk::Modifiers

Included in:
ModifiedSdk, TheOne
Defined in:
lib/elephant_in_the_room/the_one_api_sdk/modified_sdk.rb

Overview

All modifiers that can modify the SDK behavior

Instance Method Summary collapse

Instance Method Details

#paginated(limit: nil, page: nil, offset: nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/elephant_in_the_room/the_one_api_sdk/modified_sdk.rb', line 25

def paginated(limit: nil, page: nil, offset: nil)
  with_pagination(@pipeline, limit: limit, page: page, offset: offset) do |paginated_pipeline|
    modified_sdk = ElephantInTheRoom::TheOneApiSdk::ModifiedSdk.new(paginated_pipeline)
    if block_given?
      yield(modified_sdk)
    else
      modified_sdk
    end
  end
end

#with_retry_strategy(retry_strategy) ⇒ Object

Replaces the default retry strategy



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/elephant_in_the_room/the_one_api_sdk/modified_sdk.rb', line 12

def with_retry_strategy(retry_strategy)
  new_retry_stage = lambda { |next_stage|
    ElephantInTheRoom::TheOneApiSdk::Pipeline::Retry.new(next_stage, retry_strategy)
  }
  new_pipeline = replace_existing_stage(@pipeline, :retry, new_retry_stage)
  modified_sdk = ElephantInTheRoom::TheOneApiSdk::ModifiedSdk.new(new_pipeline)
  if block_given?
    yield(modified_sdk)
  else
    modified_sdk
  end
end