Exception: MindMeisterClient::RequestError
- Inherits:
-
Exception
- Object
- Exception
- MindMeisterClient::RequestError
- Defined in:
- lib/mind_meister_client/request_error.rb
Constant Summary collapse
- MM_ERROR_OBJECT_NOT_FOUND =
Object not found
20- MM_ERROR_REQUIRED_PARAMETER_MISSING =
Well…
23- MM_ERROR_INVALID_SIGNATURE =
The passed signature was invalid.
96- MM_ERROR_MISSING_SIGNATURE =
The call required signing but no signature was sent.
97- MM_ERROR_LOGIN_FAILED =
The login details or auth token passed were invalid.
98- MM_ERROR_INVALID_API_KEY =
The API key passed was not valid or has expired.
100- MM_ERROR_INVALID_FROB =
The specified frob does not exist or has already been used.
108- MM_ERROR_METHOD_NOT_FOUND =
The requested method was not found.
112
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#msg ⇒ Object
Returns the value of attribute msg.
-
#provided_data ⇒ Object
Returns the value of attribute provided_data.
-
#template ⇒ Object
Returns the value of attribute template.
Instance Method Summary collapse
-
#initialize(code, msg, provided_data) ⇒ RequestError
constructor
A new instance of RequestError.
- #setup_template ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(code, msg, provided_data) ⇒ RequestError
Returns a new instance of RequestError.
28 29 30 31 32 |
# File 'lib/mind_meister_client/request_error.rb', line 28 def initialize code, msg, provided_data @code = code @msg = msg @provided_data = provided_data end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
20 21 22 |
# File 'lib/mind_meister_client/request_error.rb', line 20 def code @code end |
#msg ⇒ Object
Returns the value of attribute msg.
21 22 23 |
# File 'lib/mind_meister_client/request_error.rb', line 21 def msg @msg end |
#provided_data ⇒ Object
Returns the value of attribute provided_data.
22 23 24 |
# File 'lib/mind_meister_client/request_error.rb', line 22 def provided_data @provided_data end |
#template ⇒ Object
Returns the value of attribute template.
23 24 25 |
# File 'lib/mind_meister_client/request_error.rb', line 23 def template @template end |
Instance Method Details
#setup_template ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/mind_meister_client/request_error.rb', line 44 def setup_template @template = '%{code}: %{method} -- %{msg}' case @code.to_i when MM_ERROR_METHOD_NOT_FOUND @template += ' (method name between >s: >%{method}<)' when MM_ERROR_REQUIRED_PARAMETER_MISSING @template += @provided_data.inspect when MM_ERROR_INVALID_FROB @template += ' (provided frob between >s: >%{frob}<)' else end end |
#to_s ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/mind_meister_client/request_error.rb', line 34 def to_s setup_template unless @template data = @provided_data.dup data[:code] = @code data[:msg] = @msg @template%data end |