Exception: Laddro::APIError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status, code = nil) ⇒ APIError

Returns a new instance of APIError.



5
6
7
8
9
# File 'lib/laddro/error.rb', line 5

def initialize(message, status, code = nil)
  super(message)
  @status = status
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

#statusObject (readonly)

Returns the value of attribute status.



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

def status
  @status
end

Instance Method Details

#auth_error?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/laddro/error.rb', line 11

def auth_error?
  status == 401
end

#not_found?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/laddro/error.rb', line 19

def not_found?
  status == 404
end

#usage_limit_error?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/laddro/error.rb', line 15

def usage_limit_error?
  status == 402
end