Module: KnuVerse::Knufactor::Helpers::APIClient
- Included in:
- APIClientBase
- Defined in:
- lib/knuverse/knufactor/helpers/api_client.rb
Overview
Simple helper methods for the API Client
Instance Method Summary collapse
-
#json_escape(s) ⇒ String
Substitute characters with their JSON-supported versions.
-
#raw ⇒ RestClient::Resource
Provides access to the “raw” underlying rest-client.
-
#version ⇒ String
The API Client version (uses Semantic Versioning).
Instance Method Details
#json_escape(s) ⇒ String
Substitute characters with their JSON-supported versions
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/knuverse/knufactor/helpers/api_client.rb', line 8 def json_escape(s) json_escape = { '&' => '\u0026', '>' => '\u003e', '<' => '\u003c', '%' => '\u0025', "\u2028" => '\u2028', "\u2029" => '\u2029' } json_escape_regex = /[\u2028\u2029&><%]/u s.to_s.gsub(json_escape_regex, json_escape) end |
#raw ⇒ RestClient::Resource
Provides access to the “raw” underlying rest-client
24 25 26 |
# File 'lib/knuverse/knufactor/helpers/api_client.rb', line 24 def raw connection end |
#version ⇒ String
The API Client version (uses Semantic Versioning)
30 31 32 |
# File 'lib/knuverse/knufactor/helpers/api_client.rb', line 30 def version VERSION end |