Class: ZendeskAPI::Error::RecordInvalid

Inherits:
ClientError
  • Object
show all
Defined in:
lib/zendesk_api/error.rb

Instance Attribute Summary collapse

Attributes inherited from ClientError

#wrapped_exception

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ RecordInvalid

Returns a new instance of RecordInvalid.



10
11
12
13
14
15
16
17
18
# File 'lib/zendesk_api/error.rb', line 10

def initialize(response)
  @response = response

  if response[:body].is_a?(Hash)
    @errors = response[:body]["details"] || response[:body]["description"]
  end

  @errors ||= {}
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



8
9
10
# File 'lib/zendesk_api/error.rb', line 8

def errors
  @errors
end

#responseObject

Returns the value of attribute response.



8
9
10
# File 'lib/zendesk_api/error.rb', line 8

def response
  @response
end

Instance Method Details

#to_sObject



20
21
22
# File 'lib/zendesk_api/error.rb', line 20

def to_s
  "#{self.class.name}: #{@errors.to_s}"
end