Exception: HomeAway::API::Errors::HomeAwayAPIError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/homeaway/api/errors/ha_api_errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response = nil) ⇒ HomeAwayAPIError

Returns a new instance of HomeAwayAPIError.



27
28
29
# File 'lib/homeaway/api/errors/ha_api_errors.rb', line 27

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

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



24
25
26
# File 'lib/homeaway/api/errors/ha_api_errors.rb', line 24

def response
  @response
end

Class Method Details

.method_missing(name, *args, &block) ⇒ Object



50
51
52
53
54
55
56
# File 'lib/homeaway/api/errors/ha_api_errors.rb', line 50

def self.method_missing(name, *args, &block)
  if @response.respond_to? name
    @response.send name
  else
    super
  end
end

Instance Method Details

#to_sObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/homeaway/api/errors/ha_api_errors.rb', line 32

def to_s
  begin
    buf = "#{self.class.name} #{@response..status_code} "
    @response.violations.each do |violation|
      buf << "#{violation.description} | "
    end
    buf = buf[0..-3] unless @response.violations.empty?
    return buf
  rescue
    if @response.nil?
      super
    else
      @response.to_s
    end
  end
end