Class: Linkscape::Response
- Inherits:
-
Object
- Object
- Linkscape::Response
- Extended by:
- Forwardable
- Defined in:
- lib/linkscape/response.rb
Defined Under Namespace
Classes: ResponseData
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
-
#valid ⇒ Object
Returns the value of attribute valid.
Instance Method Summary collapse
-
#initialize(request, response) ⇒ Response
constructor
A new instance of Response.
- #inspect ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(request, response) ⇒ Response
Returns a new instance of Response.
122 123 124 125 126 127 128 129 130 |
# File 'lib/linkscape/response.rb', line 122 def initialize(request, response) @valid = false @request = request @response = response if Net::HTTPSuccess === response @data = ResponseData.new(JSON.parse(response.body)) @valid = true end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
120 121 122 |
# File 'lib/linkscape/response.rb', line 120 def data @data end |
#request ⇒ Object
Returns the value of attribute request.
120 121 122 |
# File 'lib/linkscape/response.rb', line 120 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
120 121 122 |
# File 'lib/linkscape/response.rb', line 120 def response @response end |
#valid ⇒ Object
Returns the value of attribute valid.
120 121 122 |
# File 'lib/linkscape/response.rb', line 120 def valid @valid end |
Instance Method Details
#inspect ⇒ Object
136 137 138 139 |
# File 'lib/linkscape/response.rb', line 136 def inspect #<Linkscape::Response:0x10161d8a0 @response=#<Net::HTTPUnauthorized 401 Unauthorized readbody=true>> %Q[#<#{self.class} @response=#{@response.class.inspect} @request="#{@request.requestURL}">] end |
#valid? ⇒ Boolean
134 |
# File 'lib/linkscape/response.rb', line 134 def valid?; valid; end |