Exception: SmsManager::SendingError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/sms_manager/error/sending_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, body) ⇒ SendingError

Returns a new instance of SendingError.



5
6
7
8
# File 'lib/sms_manager/error/sending_error.rb', line 5

def initialize(options, body)
  @code = body.split('|').last.to_i
  @options = options
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/sms_manager/error/sending_error.rb', line 3

def code
  @code
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/sms_manager/error/sending_error.rb', line 3

def options
  @options
end

Instance Method Details

#messageObject



10
11
12
13
14
15
16
17
18
# File 'lib/sms_manager/error/sending_error.rb', line 10

def message
  if code >= 900 && code <= 999
    CODE_9XX
  elsif CODES[code]
    CODES[code]
  else
    'Neznámý chybový kód'
  end
end