Exception: SmsRu::ResponseError
- Defined in:
- lib/sms_ru/errors.rb
Overview
Raised when SMS.ru replies with a non-OK status. Carries the API’s numeric ‘code` and human-readable `text` (status_text).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#code ⇒ Integer
readonly
The SMS.ru numeric status code.
-
#text ⇒ String
readonly
The human-readable status text.
Instance Method Summary collapse
-
#initialize(code:, text:) ⇒ ResponseError
constructor
A new instance of ResponseError.
Constructor Details
#initialize(code:, text:) ⇒ ResponseError
Returns a new instance of ResponseError.
23 24 25 26 27 |
# File 'lib/sms_ru/errors.rb', line 23 def initialize(code:, text:) @code = code @text = text super("[#{code}] #{text}") end |
Instance Attribute Details
#code ⇒ Integer (readonly)
Returns the SMS.ru numeric status code.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sms_ru/errors.rb', line 18 class ResponseError < Error attr_reader :code, :text # @param code [Integer] the SMS.ru numeric status code # @param text [String] the human-readable status text def initialize(code:, text:) @code = code @text = text super("[#{code}] #{text}") end end |
#text ⇒ String (readonly)
Returns the human-readable status text.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/sms_ru/errors.rb', line 18 class ResponseError < Error attr_reader :code, :text # @param code [Integer] the SMS.ru numeric status code # @param text [String] the human-readable status text def initialize(code:, text:) @code = code @text = text super("[#{code}] #{text}") end end |