Class: RSpec::Cassette::Interaction
- Inherits:
-
Object
- Object
- RSpec::Cassette::Interaction
- Defined in:
- lib/rspec/cassette/interaction.rb
Instance Attribute Summary collapse
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(raw_interaction) ⇒ Interaction
constructor
A new instance of Interaction.
- #method ⇒ Object
- #request_body ⇒ Object
- #request_headers ⇒ Object
- #response_body ⇒ Object
- #response_headers ⇒ Object
- #status ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(raw_interaction) ⇒ Interaction
Returns a new instance of Interaction.
8 9 10 11 |
# File 'lib/rspec/cassette/interaction.rb', line 8 def initialize(raw_interaction) @request = raw_interaction.fetch("request") @response = raw_interaction.fetch("response") end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
6 7 8 |
# File 'lib/rspec/cassette/interaction.rb', line 6 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/rspec/cassette/interaction.rb', line 6 def response @response end |
Instance Method Details
#method ⇒ Object
13 14 15 |
# File 'lib/rspec/cassette/interaction.rb', line 13 def method request.fetch("method").to_sym end |
#request_body ⇒ Object
25 26 27 28 |
# File 'lib/rspec/cassette/interaction.rb', line 25 def request_body body = request.fetch("body", {}) || {} body.fetch("string", "") end |
#request_headers ⇒ Object
21 22 23 |
# File 'lib/rspec/cassette/interaction.rb', line 21 def request_headers request.fetch("headers", {}) || {} end |
#response_body ⇒ Object
38 39 40 41 |
# File 'lib/rspec/cassette/interaction.rb', line 38 def response_body body = response.fetch("body", {}) || {} body.fetch("string", "") end |
#response_headers ⇒ Object
34 35 36 |
# File 'lib/rspec/cassette/interaction.rb', line 34 def response_headers response.fetch("headers", {}) || {} end |
#status ⇒ Object
30 31 32 |
# File 'lib/rspec/cassette/interaction.rb', line 30 def status response.fetch("status", {}).fetch("code") end |
#uri ⇒ Object
17 18 19 |
# File 'lib/rspec/cassette/interaction.rb', line 17 def uri request.fetch("uri") end |