Class: RedSnow::TransactionExample
- Inherits:
-
NamedBlueprintNode
- Object
- BlueprintNode
- NamedBlueprintNode
- RedSnow::TransactionExample
- Defined in:
- lib/redsnow/blueprint.rb
Overview
Transaction example Blueprint AST node
Instance Attribute Summary collapse
-
#requests ⇒ Array<Request>
example request payloads.
-
#response ⇒ Array<Response>
example response payloads.
-
#responses ⇒ Object
Returns the value of attribute responses.
Attributes inherited from NamedBlueprintNode
Instance Method Summary collapse
-
#initialize(example) ⇒ TransactionExample
constructor
A new instance of TransactionExample.
Methods inherited from NamedBlueprintNode
Constructor Details
#initialize(example) ⇒ TransactionExample
Returns a new instance of TransactionExample.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 |
# File 'lib/redsnow/blueprint.rb', line 225 def initialize(example) @name = example.fetch('name', '') @description = example.fetch('description', '') @requests = [] example.key?('requests') && example['requests'].each do |request| @requests << Payload.new(request).tap do |inst| example_instance = self inst.define_singleton_method(:example) { example_instance } end end @responses = [] example.key?('responses') && example['responses'].each do |response| @responses << Payload.new(response).tap do |inst| example_instance = self inst.define_singleton_method(:example) { example_instance } end end end |
Instance Attribute Details
#requests ⇒ Array<Request>
example request payloads
220 221 222 |
# File 'lib/redsnow/blueprint.rb', line 220 def requests @requests end |
#response ⇒ Array<Response>
example response payloads
220 221 222 |
# File 'lib/redsnow/blueprint.rb', line 220 def response @response end |
#responses ⇒ Object
Returns the value of attribute responses.
222 223 224 |
# File 'lib/redsnow/blueprint.rb', line 222 def responses @responses end |