Sha256: a4dc32538829ca8f8f9a87b0dc72cf3e595e226cb9f91ce7eab0bc4199a4ceaf
Contents?: true
Size: 984 Bytes
Versions: 49
Compression:
Stored size: 984 Bytes
Contents
class Shelly::Client class APIException < Exception attr_reader :status_code, :body, :request_id def initialize(body = {}, status_code = nil, request_id = nil) @status_code = status_code @body = body @request_id = request_id end def [](key) body[key.to_s] end end class UnauthorizedException < APIException; end class ForbiddenException < APIException; end class ConflictException < APIException; end class GemVersionException < APIException; end class GatewayTimeoutException < APIException; end class LockedException < APIException; end class ValidationException < APIException def errors self[:errors] end def each_error errors.each do |field, message| yield [field.gsub('_',' ').capitalize, message].join(" ") end end end class NotFoundException < APIException def resource self[:resource].to_sym end def id self[:id] end end end
Version data entries
49 entries across 49 versions & 1 rubygems