Module: EndPointBlank::Writers::Shared

Included in:
ExceptionWriter, LogWriter, RequestWriter, ResponseWriter
Defined in:
lib/end_point_blank/writers/shared.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#urlObject

Returns the value of attribute url.



4
5
6
# File 'lib/end_point_blank/writers/shared.rb', line 4

def url
  @url
end

Instance Method Details

#app_nameObject



10
11
12
# File 'lib/end_point_blank/writers/shared.rb', line 10

def app_name
  configuration.app_name
end

#apply_masking(payload, record_type) ⇒ Object



34
35
36
# File 'lib/end_point_blank/writers/shared.rb', line 34

def apply_masking(payload, record_type)
  EndPointBlank::Masking.apply(payload, record_type, configuration.masking_rules, configuration.mask_hook)
end

#configurationObject



6
7
8
# File 'lib/end_point_blank/writers/shared.rb', line 6

def configuration
  Configuration.instance
end

#envObject



18
19
20
# File 'lib/end_point_blank/writers/shared.rb', line 18

def env
  ::EndPointBlank::Rack::EnvStore.get
end

#env_nameObject



14
15
16
# File 'lib/end_point_blank/writers/shared.rb', line 14

def env_name
  SessionConfiguration.env_name
end

#request_uuid(env) ⇒ Object

Rails' ActionDispatch::Request#uuid simply reads this same Rack env key, so this is behavior-preserving when running under Rails, and gracefully returns nil when it isn't (plain Rack / Sinatra), instead of requiring actionpack's ActionDispatch::Request to be loaded.



30
31
32
# File 'lib/end_point_blank/writers/shared.rb', line 30

def request_uuid(env)
  env && env["action_dispatch.request_id"]
end

#source_application_environment_idObject



22
23
24
# File 'lib/end_point_blank/writers/shared.rb', line 22

def source_application_environment_id
  ::EndPointBlank::Rack::EnvStore.source_application_environment_id
end