Class: Smsconnect::Error

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

Constant Summary collapse

ERRORS =
{
	'-1' => 'duplicitni user_id - stejne oznacena sms byla odeslana jiz v minulosti',
	'0' => 'OK',
	'1' => 'neznama chyba',
	'2' => 'neplatny login',
	'3' => 'neplatny hash nebo password (podle varianty zabezpeceni prihlaseni)',
	'4' => 'neplatny time, vetsi odchylka casu mezi servery nez maximalni akceptovana v nastaveni sluzby SMS Connect',
	'5' => 'nepovolena IP, viz nastaveni sluzby SMS Connect',
	'6' => 'neplatny nazev akce',
	'7' => 'tato sul byla jiz jednou za dany den pouzita',
	'8' => 'nebylo navazano spojeni s databazi',
	'9' => 'nedostatecny kredit',
	'10' => 'neplatne cislo prijemce SMS',
	'11' => 'prazdny text zpravy',
	'12' => 'SMS je delsi nez povolenych 459 znaku',
}

Instance Method Summary collapse

Constructor Details

#initialize(error) ⇒ Error

Returns a new instance of Error.



21
22
23
# File 'lib/error.rb', line 21

def initialize(error)
	@error = error
end

Instance Method Details

#is_error?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/error.rb', line 32

def is_error?
	@error != '0' && @error != nil
end

#messageObject



25
26
27
28
29
30
# File 'lib/error.rb', line 25

def message
	if ERRORS.key? @error
		return ERRORS[@error]
	end
	"Unknown error"
end