Class: QueryGuard::Uploader::NoOpUploader

Inherits:
Interface
  • Object
show all
Defined in:
lib/query_guard/uploader/no_op_uploader.rb

Overview

No-op uploader that discards reports (default behavior).

This is the default uploader when no remote API is configured. It silently discards reports, making the upload system completely optional.

Use case:

  • Local development without remote API
  • CI/CD without SaaS platform integration
  • Organizations that don't want to send data to external services

Instance Method Summary collapse

Constructor Details

#initialize(config = nil) ⇒ NoOpUploader

Returns a new instance of NoOpUploader.



15
16
17
# File 'lib/query_guard/uploader/no_op_uploader.rb', line 15

def initialize(config = nil)
  @config = config
end

Instance Method Details

#name ⇒ Object



33
34
35
# File 'lib/query_guard/uploader/no_op_uploader.rb', line 33

def name
  'no-op'
end

#ready? ⇒ Boolean

Always ready (no configuration needed).

Returns:

  • (Boolean)


29
30
31
# File 'lib/query_guard/uploader/no_op_uploader.rb', line 29

def ready?
  true
end

#status ⇒ Object



37
38
39
40
41
42
43
# File 'lib/query_guard/uploader/no_op_uploader.rb', line 37

def status
  {
    enabled: false,
    mode: 'no-op',
    description: 'Reports are discarded (upload disabled)'
  }
end

#upload(json_report, metadata = {}) ⇒ Object

Always succeeds, does nothing.



20
21
22
23
24
25
26
# File 'lib/query_guard/uploader/no_op_uploader.rb', line 20

def upload(json_report,  = {})
  UploadResult.new(
    success: true,
    uploader_name: name,
    details: { discarded: true, bytes: json_report.bytesize }
  )
end