Exception: SmsRu::ResponseError

Inherits:
Error
  • Object
show all
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

AuthError, InsufficientFundsError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, text:) ⇒ ResponseError

Returns a new instance of ResponseError.

Parameters:

  • code (Integer)

    the SMS.ru numeric status code

  • text (String)

    the human-readable status text



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

#codeInteger (readonly)

Returns the SMS.ru numeric status code.

Returns:

  • (Integer)

    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

#textString (readonly)

Returns the human-readable status text.

Returns:

  • (String)

    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