Class: EC2::Common::Curl::Response
- Inherits:
-
Object
- Object
- EC2::Common::Curl::Response
- Defined in:
- lib/ec2/common/curl.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(code, type) ⇒ Response
constructor
A new instance of Response.
- #redirect? ⇒ Boolean
- #success? ⇒ Boolean
- #text? ⇒ Boolean
Constructor Details
#initialize(code, type) ⇒ Response
Returns a new instance of Response.
34 35 36 37 |
# File 'lib/ec2/common/curl.rb', line 34 def initialize(code, type) @code = code.to_i @type = type end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
33 34 35 |
# File 'lib/ec2/common/curl.rb', line 33 def code @code end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
33 34 35 |
# File 'lib/ec2/common/curl.rb', line 33 def type @type end |
Instance Method Details
#redirect? ⇒ Boolean
41 42 43 |
# File 'lib/ec2/common/curl.rb', line 41 def redirect? (300..399).include? @code end |
#success? ⇒ Boolean
38 39 40 |
# File 'lib/ec2/common/curl.rb', line 38 def success? (200..299).include? @code end |
#text? ⇒ Boolean
44 45 46 |
# File 'lib/ec2/common/curl.rb', line 44 def text? @type =~ /(text|xml)/ end |