Class: Everdeen::Expectation
- Inherits:
-
Object
- Object
- Everdeen::Expectation
- Defined in:
- lib/everdeen/expectation.rb
Instance Attribute Summary collapse
-
#max_matches ⇒ Object
readonly
Returns the value of attribute max_matches.
-
#request_criteria ⇒ Object
readonly
Returns the value of attribute request_criteria.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Expectation
constructor
A new instance of Expectation.
- #pass_through ⇒ Object
- #store_matching_requests ⇒ Object
- #to_hash ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Expectation
Returns a new instance of Expectation.
5 6 7 8 9 10 11 12 13 |
# File 'lib/everdeen/expectation.rb', line 5 def initialize(args = {}) args.each do |key, value| next if ['response', 'request_criteria'].include?(key.to_s) instance_variable_set("@#{key}", value) end add_response(args[:response] || args['response']) add_request(args[:request_criteria] || args['request_criteria']) end |
Instance Attribute Details
#max_matches ⇒ Object (readonly)
Returns the value of attribute max_matches.
3 4 5 |
# File 'lib/everdeen/expectation.rb', line 3 def max_matches @max_matches end |
#request_criteria ⇒ Object (readonly)
Returns the value of attribute request_criteria.
3 4 5 |
# File 'lib/everdeen/expectation.rb', line 3 def request_criteria @request_criteria end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
3 4 5 |
# File 'lib/everdeen/expectation.rb', line 3 def response @response end |
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
3 4 5 |
# File 'lib/everdeen/expectation.rb', line 3 def uuid @uuid end |
Instance Method Details
#pass_through ⇒ Object
15 16 17 |
# File 'lib/everdeen/expectation.rb', line 15 def pass_through !!@pass_through end |
#store_matching_requests ⇒ Object
19 20 21 |
# File 'lib/everdeen/expectation.rb', line 19 def store_matching_requests !!@store_matching_requests end |
#to_hash ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/everdeen/expectation.rb', line 23 def to_hash { store_matching_requests: store_matching_requests, max_matches: max_matches, pass_through: pass_through, request_criteria: request_criteria.to_hash, respond_with: response.to_hash } end |