Class: SecurityPentestPlanner::OpenAPIParser::Parameter

Inherits:
Struct
  • Object
show all
Defined in:
lib/security_pentest_planner/openapi_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description

Returns:

  • (Object)

    the current value of description



22
23
24
# File 'lib/security_pentest_planner/openapi_parser.rb', line 22

def description
  @description
end

#locationObject

Returns the value of attribute location

Returns:

  • (Object)

    the current value of location



22
23
24
# File 'lib/security_pentest_planner/openapi_parser.rb', line 22

def location
  @location
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



22
23
24
# File 'lib/security_pentest_planner/openapi_parser.rb', line 22

def name
  @name
end

#requiredObject

Returns the value of attribute required

Returns:

  • (Object)

    the current value of required



22
23
24
# File 'lib/security_pentest_planner/openapi_parser.rb', line 22

def required
  @required
end

#schemaObject

Returns the value of attribute schema

Returns:

  • (Object)

    the current value of schema



22
23
24
# File 'lib/security_pentest_planner/openapi_parser.rb', line 22

def schema
  @schema
end

Instance Method Details

#date_param?Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/security_pentest_planner/openapi_parser.rb', line 42

def date_param?
  location == "query" && name.match?(DATE_PARAM_PATTERN)
end

#enum_param?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/security_pentest_planner/openapi_parser.rb', line 50

def enum_param?
  enum_values.any? || schema&.dig("items", "enum")&.any?
end

#enum_valuesObject



30
31
32
# File 'lib/security_pentest_planner/openapi_parser.rb', line 30

def enum_values
  schema&.dig("enum") || schema&.dig("items", "enum") || []
end

#tenant_header?Boolean

Returns:

  • (Boolean)


38
39
40
# File 'lib/security_pentest_planner/openapi_parser.rb', line 38

def tenant_header?
  location == "header" && name.match?(TENANT_HEADER_PATTERN)
end

#timezone_header?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/security_pentest_planner/openapi_parser.rb', line 46

def timezone_header?
  location == "header" && name.match?(TIMEZONE_HEADER_PATTERN)
end

#typeObject



34
35
36
# File 'lib/security_pentest_planner/openapi_parser.rb', line 34

def type
  schema&.dig("type")
end