Exception: Wesabe::Request::RequestFailed

Inherits:
Exception
  • Object
show all
Defined in:
lib/wesabe/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response = nil) ⇒ RequestFailed

Returns a new instance of RequestFailed.



166
167
168
# File 'lib/wesabe/request.rb', line 166

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

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



164
165
166
# File 'lib/wesabe/request.rb', line 164

def response
  @response
end

Instance Method Details

#inspectObject



182
183
184
# File 'lib/wesabe/request.rb', line 182

def inspect
  "#<#{self.class.name} Status=#{response.code} Message=#{message.inspect}>"
end

#messageObject



170
171
172
173
174
175
176
# File 'lib/wesabe/request.rb', line 170

def message
  begin
    (Hpricot.XML(response.body) / :error / :message).inner_text
  rescue
    response.body
  end
end

#to_sObject



178
179
180
# File 'lib/wesabe/request.rb', line 178

def to_s
  message
end