Class: Prevoty::Intelligence

Inherits:
Object
  • Object
show all
Defined in:
lib/prevoty/responses/query_analysis.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Intelligence

Returns a new instance of Intelligence.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/prevoty/responses/query_analysis.rb', line 68

def initialize(data)
  @statement_type = data["statement_type"]
  @sanitized_statement = data["sanitized_statement"]
  @hashed_statement = data["hashed_statement"]
  @has_comment = data["has_comment"]
  @comparison_types = ComparisonTypes.new(data["comparison_types"])
  @row_creates = data["row_creates"].map {|el| Table.new(el)}
  @column_reads = data["column_reads"].map {|el| Column.new(el)}
  @column_updates = data["column_updates"].map {|el| Column.new(el)}
  @row_deletes = data["row_deletes"].map {|el| Table.new(el)}
  @has_admin = data["has_admin"]
  @function_calls = data["function_calls"].map {|el| FunctionCall.new(el)}
  @joins = data["joins"].map {|el| Table.new(el)}
  @unions = data["unions"].map {|el| Table.new(el)}
  @subqueries = data["subqueries"].map {|el| Table.new(el)}
end

Instance Attribute Details

#column_readsObject (readonly)

Returns the value of attribute column_reads.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def column_reads
  @column_reads
end

#column_updatesObject (readonly)

Returns the value of attribute column_updates.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def column_updates
  @column_updates
end

#comparison_typesObject (readonly)

Returns the value of attribute comparison_types.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def comparison_types
  @comparison_types
end

#function_callsObject (readonly)

Returns the value of attribute function_calls.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def function_calls
  @function_calls
end

#has_adminObject (readonly)

Returns the value of attribute has_admin.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def has_admin
  @has_admin
end

#has_commentObject (readonly)

Returns the value of attribute has_comment.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def has_comment
  @has_comment
end

#hashed_statementObject (readonly)

Returns the value of attribute hashed_statement.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def hashed_statement
  @hashed_statement
end

#joinsObject (readonly)

Returns the value of attribute joins.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def joins
  @joins
end

#row_createsObject (readonly)

Returns the value of attribute row_creates.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def row_creates
  @row_creates
end

#row_deletesObject (readonly)

Returns the value of attribute row_deletes.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def row_deletes
  @row_deletes
end

#sanitized_statementObject (readonly)

Returns the value of attribute sanitized_statement.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def sanitized_statement
  @sanitized_statement
end

#statement_typeObject (readonly)

Returns the value of attribute statement_type.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def statement_type
  @statement_type
end

#subqueriesObject (readonly)

Returns the value of attribute subqueries.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def subqueries
  @subqueries
end

#unionsObject (readonly)

Returns the value of attribute unions.



63
64
65
# File 'lib/prevoty/responses/query_analysis.rb', line 63

def unions
  @unions
end

Instance Method Details

#to_json(options) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/prevoty/responses/query_analysis.rb', line 85

def to_json(options)
  return {
    statement_type: @statement_type,
    sanitized_statement: @sanitized_statement,
    hashed_statement: @hashed_statement, has_comment: @has_comment,
    comparison_types: @comparison_types, row_creates: @row_creates,
    column_reads: @column_reads, column_upates: @column_updates,
    row_deletes: @row_deletes, has_admin: @has_admin,
    function_calls: @function_calls, joins: @joins, unions: @unions,
    subqueries: @subqueries
  }.to_json
end