Class: IdempotentRequest::Callback

Inherits:
Object
  • Object
show all
Defined in:
lib/idempotent_request/callback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Callback

Returns a new instance of Callback.



7
8
9
# File 'lib/idempotent_request/callback.rb', line 7

def initialize(request)
  @request = request
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request.



5
6
7
# File 'lib/idempotent_request/callback.rb', line 5

def request
  @request
end

Instance Method Details

#detected(key:) ⇒ Object



11
12
13
# File 'lib/idempotent_request/callback.rb', line 11

def detected(key:)
  Rails.logger.warn "IdempotentRequest request detected, #{message_params(key: key)}"
end

#message_params(key:) ⇒ Object



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

def message_params(key:)
  {
    key: key,
    method: request.request.request_method,
    path: request.request.path_info
  }
    .map { |k, v| "#{k}: #{v}" }
    .join(", ")
end