Sha256: 76906dc41367c78adb2692d2ec0a878d226e5c8bb822adb768d97f9512fadf12

Contents?: true

Size: 528 Bytes

Versions: 3

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

module Strava
  module Errors
    class UploadError < ::Faraday::ClientError
      def status
        response[:status]
      end

      def headers
        response[:headers]
      end

      def message
        body[:error] || super
      end

      def error_status
        body[:status]
      end

      def upload
        @upload ||= Strava::Models::Upload.new(body)
      end

      private

      def body
        (response[:body] || {}).with_indifferent_access
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
strava-ruby-client-2.2.0 lib/strava/errors/upload_error.rb
strava-ruby-client-2.1.0 lib/strava/errors/upload_error.rb
strava-ruby-client-2.0.0 lib/strava/errors/upload_error.rb