Class: Nexmo::Markdown::CodeSnippetRenderer::Curl
- Defined in:
- lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb
Class Method Summary collapse
- .add_instructions(filename) ⇒ Object
- .create_instructions(filename) ⇒ Object
- .dependencies(deps, _version) ⇒ Object
- .post_process(code) ⇒ Object
- .run_command(command, _filename, _file_path) ⇒ Object
- .strip_single_quotes(code) ⇒ Object
Methods inherited from Base
Class Method Details
.add_instructions(filename) ⇒ Object
22 23 24 |
# File 'lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb', line 22 def self.add_instructions(filename) ::I18n.t('services.code_snippet_renderer.add_instructions_to_file', file: filename) end |
.create_instructions(filename) ⇒ Object
18 19 20 |
# File 'lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb', line 18 def self.create_instructions(filename) ::I18n.t('services.code_snippet_renderer.create_instructions', filename: filename) end |
.dependencies(deps, _version) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb', line 5 def self.dependencies(deps, _version) dependencies = deps.map(&:upcase) raise t('.only_permitted_dependency') unless dependencies.include?('JWT') { 'text' => t('services.code_snippet_renderer.curl.text'), 'code' => 'export JWT=$(nexmo jwt:generate $PATH_TO_PRIVATE_KEY application_id=$NEXMO_APPLICATION_ID)', } end |
.post_process(code) ⇒ Object
26 27 28 |
# File 'lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb', line 26 def self.post_process(code) self.strip_single_quotes(code) end |
.run_command(command, _filename, _file_path) ⇒ Object
14 15 16 |
# File 'lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb', line 14 def self.run_command(command, _filename, _file_path) ::I18n.t('services.code_snippet_renderer.run_command', command: command) end |
.strip_single_quotes(code) ⇒ Object
30 31 32 |
# File 'lib/nexmo_markdown_renderer/services/code_snippet_renderer/curl.rb', line 30 def self.strip_single_quotes(code) code.gsub(/"'(\$\w+)'"/, '"\1"') end |