Class: Wrappi::Executer

Inherits:
Object
  • Object
show all
Defined in:
lib/wrappi/executer.rb,
lib/wrappi/executer/cacher.rb,
lib/wrappi/executer/retryer.rb

Defined Under Namespace

Classes: Cacher, Retryer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint) ⇒ Executer

Returns a new instance of Executer.



9
10
11
12
13
# File 'lib/wrappi/executer.rb', line 9

def initialize(endpoint)
  @endpoint = endpoint
  @retryer = Retryer.new(endpoint)
  @cacher = Cacher.new(endpoint)
end

Instance Attribute Details

#cacherObject (readonly)

Returns the value of attribute cacher.



8
9
10
# File 'lib/wrappi/executer.rb', line 8

def cacher
  @cacher
end

#endpointObject (readonly)

Returns the value of attribute endpoint.



8
9
10
# File 'lib/wrappi/executer.rb', line 8

def endpoint
  @endpoint
end

#retryerObject (readonly)

Returns the value of attribute retryer.



8
9
10
# File 'lib/wrappi/executer.rb', line 8

def retryer
  @retryer
end

Class Method Details

.call(*args) ⇒ Object



4
5
6
# File 'lib/wrappi/executer.rb', line 4

def self.call(*args)
  new(*args).call
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
22
23
# File 'lib/wrappi/executer.rb', line 15

def call
  if cache?
    cacher.call do
      request_with_retry
    end
  else
    request_with_retry
  end
end