Sha256: f9bb0fd20165d31ac24d23a7c9b5c4b2bcad36ddf235d5c37b4df62e5ed4cd7e

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

module Workarea
  module Zendesk
    class Response
      attr_reader :response

      def initialize(response = {})
        @response = response
      end

      def success?
        @response.status.to_s =~ /^2/
      end

      def body
        return {} unless @response.body.present?
        JSON.parse(@response.body)
      end

      def error_details
        return unless body.present?
        return unless body["error"].present?

        body["details"].to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-zendesk-1.0.0 app/lib/workarea/zendesk/response.rb