Class: Textus::Action::Audit::Query

Inherits:
Data
  • Object
show all
Defined in:
lib/textus/action/audit.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#correlation_idObject (readonly)

Returns the value of attribute correlation_id

Returns:

  • (Object)

    the current value of correlation_id



76
77
78
# File 'lib/textus/action/audit.rb', line 76

def correlation_id
  @correlation_id
end

#keyObject (readonly)

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



76
77
78
# File 'lib/textus/action/audit.rb', line 76

def key
  @key
end

#laneObject (readonly)

Returns the value of attribute lane

Returns:

  • (Object)

    the current value of lane



76
77
78
# File 'lib/textus/action/audit.rb', line 76

def lane
  @lane
end

#limitObject (readonly)

Returns the value of attribute limit

Returns:

  • (Object)

    the current value of limit



76
77
78
# File 'lib/textus/action/audit.rb', line 76

def limit
  @limit
end

#roleObject (readonly)

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



76
77
78
# File 'lib/textus/action/audit.rb', line 76

def role
  @role
end

#seq_sinceObject (readonly)

Returns the value of attribute seq_since

Returns:

  • (Object)

    the current value of seq_since



76
77
78
# File 'lib/textus/action/audit.rb', line 76

def seq_since
  @seq_since
end

#sinceObject (readonly)

Returns the value of attribute since

Returns:

  • (Object)

    the current value of since



76
77
78
# File 'lib/textus/action/audit.rb', line 76

def since
  @since
end

#verbObject (readonly)

Returns the value of attribute verb

Returns:

  • (Object)

    the current value of verb



76
77
78
# File 'lib/textus/action/audit.rb', line 76

def verb
  @verb
end

Class Method Details

.build(key: nil, lane: nil, role: nil, verb: nil, since: nil, seq_since: nil, correlation_id: nil, limit: nil) ⇒ Object

rubocop:disable Metrics/ParameterLists



78
79
80
81
# File 'lib/textus/action/audit.rb', line 78

def self.build(key: nil, lane: nil, role: nil, verb: nil,
               since: nil, seq_since: nil, correlation_id: nil, limit: nil)
  new(key:, lane:, role:, verb:, since:, seq_since:, correlation_id:, limit:)
end

Instance Method Details

#matches?(row) ⇒ Boolean

rubocop:enable Metrics/ParameterLists

Returns:

  • (Boolean)


84
85
86
87
88
89
90
91
92
93
# File 'lib/textus/action/audit.rb', line 84

def matches?(row)
  return false if key && row["key"] != key
  return false if role && row["role"] != role
  return false if verb && row["verb"] != verb
  return false if since && (row["ts"].nil? || Time.parse(row["ts"]) < since)
  return false if seq_since && (row["seq"].nil? || row["seq"] <= seq_since)
  return false if correlation_id && row.dig("extras", "correlation_id") != correlation_id

  true
end