Class: Spec::Client::Http::Transaction
- Inherits:
-
Object
- Object
- Spec::Client::Http::Transaction
- Defined in:
- lib/spec/client/http/transaction.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
- #execute ⇒ Object
-
#initialize(request) ⇒ Transaction
constructor
A new instance of Transaction.
- #redirect? ⇒ Boolean
- #success? ⇒ Boolean
Constructor Details
#initialize(request) ⇒ Transaction
Returns a new instance of Transaction.
9 10 11 12 |
# File 'lib/spec/client/http/transaction.rb', line 9 def initialize(request) @request = request @response = nil end |
Instance Attribute Details
#request ⇒ Object (readonly)
Returns the value of attribute request.
7 8 9 |
# File 'lib/spec/client/http/transaction.rb', line 7 def request @request end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/spec/client/http/transaction.rb', line 7 def response @response end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 |
# File 'lib/spec/client/http/transaction.rb', line 14 def execute @response = request.execute self end |
#redirect? ⇒ Boolean
23 24 25 |
# File 'lib/spec/client/http/transaction.rb', line 23 def redirect? (300..399).include? @response.code end |
#success? ⇒ Boolean
19 20 21 |
# File 'lib/spec/client/http/transaction.rb', line 19 def success? (200..299).include? @response.code end |