Sha256: e8582b2ee6921ae3c0429f9899eacb30340ea61ad876060f71a6a48e2da4723a

Contents?: true

Size: 682 Bytes

Versions: 9

Compression:

Stored size: 682 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

9 entries across 9 versions & 1 rubygems

Version Path
timetree-0.2.0 lib/timetree/api_error.rb
timetree-0.1.7 lib/timetree/api_error.rb
timetree-0.1.6 lib/timetree/api_error.rb
timetree-0.1.5 lib/timetree/api_error.rb
timetree-0.1.4 lib/timetree/api_error.rb
timetree-0.1.3 lib/timetree/api_error.rb
timetree-0.1.2 lib/timetree/api_error.rb
timetree-0.1.1 lib/timetree/api_error.rb
timetree-0.1.0 lib/timetree/api_error.rb