Sha256: 53b56b637ccd9a76d6ea564214f9fd839595ea0db6074660bc914773c4683808

Contents?: true

Size: 680 Bytes

Versions: 5

Compression:

Stored size: 680 Bytes

Contents

# frozen_string_literal: true

module TimeTree
  # TimeTree apis client error object.
  class ApiError < StandardError
    # @return [Faraday::Response]
    attr_reader :response
    # @return [String]
    attr_reader :type
    # @return [String]
    attr_reader :title
    # @return [String]
    attr_reader :errors
    # @return [Integer]
    attr_reader :status

    def initialize(response)
      @response = response
      @type = response.body[:type]
      @title = response.body[:title]
      @errors = response.body[:errors]
      @status = response.status
    end

    def inspect
      "\#<#{self.class}:#{object_id} title:#{title}, status:#{status}>"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
timetree-1.0.0 lib/timetree/api_error.rb
timetree-0.3.2 lib/timetree/api_error.rb
timetree-0.3.1 lib/timetree/api_error.rb
timetree-0.3.0 lib/timetree/api_error.rb
timetree-0.2.1 lib/timetree/api_error.rb