Sha256: 5f743482e180c3c56265471e0da61ca8acc2663112ee739284a57733fd1b901c

Contents?: true

Size: 514 Bytes

Versions: 5

Compression:

Stored size: 514 Bytes

Contents

module ZendeskAPI
  module Error
    class ClientError < Faraday::Error::ClientError; end

    class RecordInvalid < ClientError
      attr_accessor :response, :errors

      def initialize(response)
        @response = response

        if response[:body].is_a?(Hash) && response[:body].key?("details")
          @errors = response[:body]["details"]
        else
          @errors = {}
        end
      end
    end

    class NetworkError < ClientError; end
    class RecordNotFound < ClientError; end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
zendesk_api-1.0.1 lib/zendesk_api/error.rb
zendesk_api-1.0.0 lib/zendesk_api/error.rb
zendesk_api-0.4.0.rc3 lib/zendesk_api/error.rb
zendesk_api-0.4.0.rc2 lib/zendesk_api/error.rb
zendesk_api-0.4.0.rc1 lib/zendesk_api/error.rb