Module: HumanError::Error
- Included in:
- HumanError::Errors::RequestError
- Defined in:
- lib/human_error/error.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#api_error_documentation_url ⇒ Object
Returns the value of attribute api_error_documentation_url.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#code ⇒ Object
Returns the value of attribute code.
-
#knowledgebase_article_id ⇒ Object
Returns the value of attribute knowledgebase_article_id.
-
#knowledgebase_url ⇒ Object
Returns the value of attribute knowledgebase_url.
-
#message ⇒ Object
Returns the value of attribute message.
Class Method Summary collapse
Instance Method Summary collapse
- #customer_support_uri ⇒ Object
- #developer_documentation_uri ⇒ Object
- #developer_message ⇒ Object
- #initialize(**args) ⇒ Object
- #to_json(_options = {}) ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#api_error_documentation_url ⇒ Object
Returns the value of attribute api_error_documentation_url.
16 17 18 |
# File 'lib/human_error/error.rb', line 16 def api_error_documentation_url @api_error_documentation_url end |
#api_version ⇒ Object
Returns the value of attribute api_version.
16 17 18 |
# File 'lib/human_error/error.rb', line 16 def api_version @api_version end |
#code ⇒ Object
Returns the value of attribute code.
16 17 18 |
# File 'lib/human_error/error.rb', line 16 def code @code end |
#knowledgebase_article_id ⇒ Object
Returns the value of attribute knowledgebase_article_id.
16 17 18 |
# File 'lib/human_error/error.rb', line 16 def knowledgebase_article_id @knowledgebase_article_id end |
#knowledgebase_url ⇒ Object
Returns the value of attribute knowledgebase_url.
16 17 18 |
# File 'lib/human_error/error.rb', line 16 def knowledgebase_url @knowledgebase_url end |
#message ⇒ Object
Returns the value of attribute message.
16 17 18 |
# File 'lib/human_error/error.rb', line 16 def @message end |
Class Method Details
.included(base) ⇒ Object
67 68 69 |
# File 'lib/human_error/error.rb', line 67 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#customer_support_uri ⇒ Object
45 46 47 |
# File 'lib/human_error/error.rb', line 45 def customer_support_uri "#{knowledgebase_url}/#{knowledgebase_article_id}" end |
#developer_documentation_uri ⇒ Object
41 42 43 |
# File 'lib/human_error/error.rb', line 41 def developer_documentation_uri "#{api_error_documentation_url}/#{code}?version=#{api_version}" end |
#developer_message ⇒ Object
63 64 65 |
# File 'lib/human_error/error.rb', line 63 def fail NoMethodError, 'This method must be implemented in a subclass' end |
#initialize(**args) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/human_error/error.rb', line 23 def initialize(**args) self.api_version = configuration.api_version self.api_error_documentation_url = configuration.api_error_documentation_url self.knowledgebase_url = configuration.knowledgebase_url args.each do |variable, value| send("#{variable}=", value) end end |
#to_json(_options = {}) ⇒ Object
49 50 51 |
# File 'lib/human_error/error.rb', line 49 def to_json( = {}) JSON.dump(as_json) end |
#to_s ⇒ Object
57 58 59 60 61 |
# File 'lib/human_error/error.rb', line 57 def to_s @message || rescue NoMethodError super end |