Exception: Foursquared::Error

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

Overview

Error class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(meta) ⇒ Error

Returns a new instance of Error.



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

def initialize meta
  @code = meta["code"]
  @detail = meta["errorDetail"]
  @type = meta["errorType"]
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/foursquared/error.rb', line 4

def code
  @code
end

#detailObject (readonly)

Returns the value of attribute detail.



4
5
6
# File 'lib/foursquared/error.rb', line 4

def detail
  @detail
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/foursquared/error.rb', line 4

def type
  @type
end

Instance Method Details

#messageObject Also known as: to_s

Error message to be displayed on encountering Foursquare::Error



12
13
14
# File 'lib/foursquared/error.rb', line 12

def message
  "#{type}: #{detail} (#{code})"
end