Sha256: 6802c968fcd689ac5e18cccd8066fcd7f397d1c6dbc91489361bddbc72c77ef6
Contents?: true
Size: 1.05 KB
Versions: 16
Compression:
Stored size: 1.05 KB
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| error = if field == 'base' message else [field.gsub('_',' ').capitalize, message].join(" ") end yield error end end end class NotFoundException < APIException def resource self[:resource].to_sym end def id self[:id] end end end
Version data entries
16 entries across 16 versions & 1 rubygems