Exception: ThreeScale::Backend::Error
- Inherits:
-
RuntimeError
- Object
- RuntimeError
- ThreeScale::Backend::Error
show all
- Defined in:
- lib/3scale/backend/errors.rb
Direct Known Subclasses
ApplicationHasInconsistentData, ApplicationKeyInvalid, ApplicationNotActive, AuthenticationError, BadRequest, Invalid, InvalidEventType, InvalidProviderKeys, LimitsExceeded, NotFound, OauthNotEnabled, ProviderKeyExists, ProviderKeyInvalid, ProviderKeyInvalidOrServiceMissing, ProviderKeyNotFound, ProviderKeyOrServiceTokenRequired, RedirectURIInvalid, RedirectURLInvalid, ReferrerFiltersMissing, ReferrerNotAllowed, ServiceIdInvalid, ServiceIsDefaultService, ServiceLoadInconsistency, ServiceNotActive, ServiceTokenInvalid, TransactionTimestampNotWithinRange, UnsupportedApiVersion, UsageValueInvalid, UserKeyInvalid
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.code ⇒ Object
21
22
23
|
# File 'lib/3scale/backend/errors.rb', line 21
def self.code
underscore(name[/[^:]*$/])
end
|
.underscore(string) ⇒ Object
25
26
27
28
29
|
# File 'lib/3scale/backend/errors.rb', line 25
def self.underscore(string)
string.gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').
downcase
end
|
Instance Method Details
#code ⇒ Object
17
18
19
|
# File 'lib/3scale/backend/errors.rb', line 17
def code
self.class.code
end
|
#http_code ⇒ Object
Note: DON’T change this to http_status; Sinatra will pick it up and break!
13
14
15
|
# File 'lib/3scale/backend/errors.rb', line 13
def http_code
403
end
|
#to_xml(options = {}) ⇒ Object
4
5
6
7
8
9
10
|
# File 'lib/3scale/backend/errors.rb', line 4
def to_xml(options = {})
xml = Builder::XmlMarkup.new
xml.instruct! unless options[:skip_instruct]
xml.error(message, :code => code)
xml.target!
end
|