Sha256: 616e37d05682159bca6c2fd5c25050563d5b9fb4766c8003bab20050cbb24be9
Contents?: true
Size: 1.38 KB
Versions: 22
Compression:
Stored size: 1.38 KB
Contents
module SparkApi # All known response codes listed in the API module ResponseCodes NOT_FOUND = 404 METHOD_NOT_ALLOWED = 405 INVALID_KEY = 1000 DISABLED_KEY = 1010 API_USER_REQUIRED = 1015 SESSION_TOKEN_EXPIRED = 1020 SSL_REQUIRED = 1030 INVALID_JSON = 1035 INVALID_FIELD = 1040 MISSING_PARAMETER = 1050 INVALID_PARAMETER = 1053 CONFLICTING_DATA = 1055 NOT_AVAILABLE= 1500 RATE_LIMIT_EXCEEDED = 1550 end # Errors built from API responses class InvalidResponse < StandardError; end class ClientError < StandardError attr_reader :code, :status, :details def initialize (options = {}) # Support the standard initializer for errors opts = options.is_a?(Hash) ? options : {:message => options.to_s} @code = opts[:code] @status = opts[:status] @details = opts[:details] super(opts[:message]) end end class NotFound < ClientError; end class PermissionDenied < ClientError; end class NotAllowed < ClientError; end class BadResourceRequest < ClientError; end # =Errors # Error messages and other error handling module Errors def self.ssl_verification_error "SSL verification problem: if connecting to a trusted but non production API endpoint, " + "set 'ssl_verify' to false in the configuration or add '--no_verify' to the CLI command." end end end
Version data entries
22 entries across 22 versions & 1 rubygems