Exception: Socialcastr::ConnectionError

Inherits:
Error
  • Object
show all
Defined in:
lib/socialcastr/exceptions.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, message = nil) ⇒ ConnectionError

Returns a new instance of ConnectionError.



8
9
10
11
# File 'lib/socialcastr/exceptions.rb', line 8

def initialize(response, message = nil)
  @response = response
  @message  = message
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/socialcastr/exceptions.rb', line 6

def response
  @response
end

Instance Method Details

#to_sObject



13
14
15
16
17
18
# File 'lib/socialcastr/exceptions.rb', line 13

def to_s
  message = "Failed."
  message << "  Response code = #{response.code}." if response.respond_to?(:code)
  message << "  Response message = #{response.message}." if response.respond_to?(:message)
  message
end