Module: Knowtify::Helper
Constant Summary collapse
- AUTHENTICATION_ERROR_MESSAGE =
"Knowtify response had authentication error, check your API key.".freeze
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
- #add_authenication_error ⇒ Object
- #blank_string?(str) ⇒ Boolean
- #client ⇒ Object
- #config ⇒ Object
- #parsed_response ⇒ Object
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
4 5 6 |
# File 'lib/knowtify/helper.rb', line 4 def errors @errors end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/knowtify/helper.rb', line 4 def response @response end |
Instance Method Details
#add_authenication_error ⇒ Object
18 19 20 21 22 |
# File 'lib/knowtify/helper.rb', line 18 def add_authenication_error Knowtify.logger.error AUTHENTICATION_ERROR_MESSAGE if Knowtify.logger @errors ||= [] @errors << AUTHENTICATION_ERROR_MESSAGE end |
#blank_string?(str) ⇒ Boolean
24 25 26 |
# File 'lib/knowtify/helper.rb', line 24 def blank_string?(str) str =~ /^\s*$/ end |
#client ⇒ Object
9 10 11 |
# File 'lib/knowtify/helper.rb', line 9 def client @client ||= Knowtify::Client.new end |
#parsed_response ⇒ Object
13 14 15 16 |
# File 'lib/knowtify/helper.rb', line 13 def parsed_response @parsed_response ||= JSON.parse(response.body) if response @parsed_response end |