Class: Dbwatcher::Storage::Api::TableAPI
- Defined in:
- lib/dbwatcher/storage/api/table_api.rb
Instance Method Summary collapse
-
#all ⇒ Array<Hash>
Get all filtered changes.
-
#by_operation(operation) ⇒ TableAPI
Filter by operation type.
-
#changes_for(table_name) ⇒ TableAPI
Filter changes for specific table.
-
#most_active(limit: 10) ⇒ Array<Hash>
Get most active tables.
-
#recent(days: 7) ⇒ TableAPI
Filter to recent changes.
Methods inherited from BaseAPI
#create, #initialize, #limit, #where
Methods included from Concerns::DataNormalizer
#extract_value, #normalize_change, #normalize_hash_keys, #normalize_operation, #normalize_record_id, #normalize_session_data, #normalize_table_name, #normalize_timestamp
Constructor Details
This class inherits a constructor from Dbwatcher::Storage::Api::BaseAPI
Instance Method Details
#all ⇒ Array<Hash>
Get all filtered changes
39 40 41 42 43 44 |
# File 'lib/dbwatcher/storage/api/table_api.rb', line 39 def all return [] unless @table_name changes = storage.load_changes(@table_name) apply_filters(changes) end |
#by_operation(operation) ⇒ TableAPI
Filter by operation type
31 32 33 34 |
# File 'lib/dbwatcher/storage/api/table_api.rb', line 31 def by_operation(operation) filters[:operation] = normalize_operation(operation) self end |
#changes_for(table_name) ⇒ TableAPI
Filter changes for specific table
13 14 15 16 |
# File 'lib/dbwatcher/storage/api/table_api.rb', line 13 def changes_for(table_name) @table_name = table_name self end |
#most_active(limit: 10) ⇒ Array<Hash>
Get most active tables
50 51 52 53 54 55 56 |
# File 'lib/dbwatcher/storage/api/table_api.rb', line 50 def most_active(limit: 10) # This would require aggregating across all tables # For now, return empty array - can be implemented later # TODO: Implement most active tables functionality with limit parameter _ = limit # Acknowledge the parameter for future use [] end |
#recent(days: 7) ⇒ TableAPI
Filter to recent changes
22 23 24 25 |
# File 'lib/dbwatcher/storage/api/table_api.rb', line 22 def recent(days: 7) filters[:recent_days] = days self end |