Class: Inspec::Resources::OpaApi
- Inherits:
-
Opa
- Object
- JsonConfig
- Opa
- Inspec::Resources::OpaApi
- Defined in:
- lib/inspec/resources/opa_api.rb
Instance Attribute Summary
Attributes inherited from JsonConfig
Instance Method Summary collapse
- #allow ⇒ Object
-
#initialize(opts = {}) ⇒ OpaApi
constructor
A new instance of OpaApi.
- #to_s ⇒ Object
Methods inherited from Opa
Methods inherited from JsonConfig
Methods included from FileReader
Methods included from ObjectTraverser
Constructor Details
#initialize(opts = {}) ⇒ OpaApi
Returns a new instance of OpaApi.
9 10 11 12 13 14 15 |
# File 'lib/inspec/resources/opa_api.rb', line 9 def initialize(opts = {}) @url = opts[:url] || nil @data = opts[:data] || nil fail_resource "OPA url and data are mandatory." if @url.nil? || @url.empty? || @data.nil? || @data.empty? @content = load_result super(@content) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Inspec::Resources::JsonConfig
Instance Method Details
#allow ⇒ Object
17 18 19 |
# File 'lib/inspec/resources/opa_api.rb', line 17 def allow @content["result"] end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/inspec/resources/opa_api.rb', line 21 def to_s "OPA api" end |