Exception: Songkick::Transport::HttpError
- Inherits:
-
UpstreamError
- Object
- RuntimeError
- UpstreamError
- Songkick::Transport::HttpError
- Defined in:
- lib/songkick/transport/http_error.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(request, status, headers, body) ⇒ HttpError
constructor
A new instance of HttpError.
- #message ⇒ Object
Constructor Details
#initialize(request, status, headers, body) ⇒ HttpError
Returns a new instance of HttpError.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/songkick/transport/http_error.rb', line 6 def initialize(request, status, headers, body) @request = request @data = if body.is_a?(String) body.strip == '' ? nil : (Yajl::Parser.parse(body) rescue body) else body end @headers = Headers.new(headers) @status = status.to_i end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
4 5 6 |
# File 'lib/songkick/transport/http_error.rb', line 4 def data @data end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
4 5 6 |
# File 'lib/songkick/transport/http_error.rb', line 4 def headers @headers end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
4 5 6 |
# File 'lib/songkick/transport/http_error.rb', line 4 def request @request end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/songkick/transport/http_error.rb', line 4 def status @status end |
Instance Method Details
#message ⇒ Object
19 20 21 |
# File 'lib/songkick/transport/http_error.rb', line 19 def "#{self.class}: status code: #{@status} from: #{@request}" end |