Sha256: abca21a9ea6ef3f630c24c1f5288de2017cfcdffb41f46da777a727d11289638

Contents?: true

Size: 291 Bytes

Versions: 3

Compression:

Stored size: 291 Bytes

Contents

module Beaconpush
  class ResponseError < StandardError
    attr_reader :response

    def initialize(response)
      @response = response
      super(message)
    end

    def message
      JSON.parse(response.body.to_s)["message"] rescue "Server responded with an error"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
beaconpush-0.0.3 lib/beaconpush/response_error.rb
beaconpush-0.0.2 lib/beaconpush/response_error.rb
beaconpush-0.0.1 lib/beaconpush/response_error.rb