Class: Apicraft::Openapi::Contract
- Inherits:
-
Object
- Object
- Apicraft::Openapi::Contract
- Includes:
- Concerns::Cacheable
- Defined in:
- lib/apicraft/openapi/contract.rb
Overview
A single openapi yaml file is represented by this Contract class.
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(document) ⇒ Contract
constructor
A new instance of Contract.
- #operation(method, path) ⇒ Object
Methods included from Concerns::Cacheable
Constructor Details
#initialize(document) ⇒ Contract
Returns a new instance of Contract.
13 14 15 |
# File 'lib/apicraft/openapi/contract.rb', line 13 def initialize(document) @document = document end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
11 12 13 |
# File 'lib/apicraft/openapi/contract.rb', line 11 def document @document end |
Class Method Details
.all ⇒ Object
31 32 33 |
# File 'lib/apicraft/openapi/contract.rb', line 31 def all @store end |
.create!(document) ⇒ Object
25 26 27 28 29 |
# File 'lib/apicraft/openapi/contract.rb', line 25 def create!(document) c = new(document) @store << c c end |
.find_by_operation(method, path) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/apicraft/openapi/contract.rb', line 35 def find_by_operation(method, path) found = nil all.each do |c| if c.operation(method, path).present? found = c break end end found end |