dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit 30d0e45d08d5e1ebae6324e6f9de81a3eee049ce
parent 494aa296dbcefe5832dce10cd87d5360521abb7d
Author: Alex Balgavy <a.balgavy@gmail.com>
Date:   Sun, 18 Oct 2020 15:10:22 +0200

vim: Ruby snippets for HTTP

Former-commit-id: c39a6a67f0a6b81aa597864977c5e1f6f629a4ff
Diffstat:
Avim/ultisnips/ruby.snippets | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/vim/ultisnips/ruby.snippets b/vim/ultisnips/ruby.snippets @@ -0,0 +1,16 @@ +snippet request_post "Post request with Net::HTTP" b +headers = {'X-Accept' => 'application/json', 'Accept' => 'application/json', 'Content-Type' => 'application/json; charset=UTF8'} +data = {${1:param_1}: ${2:value_1}} +response = Net::HTTP.post URI(${3:destination url}), data.to_json, headers +if response.code == '200' + ${4:# code if OK} +else + ${5:# code if not} +end +endsnippet + +snippet request_get "Get request with open-uri" b +headers = {'Accept' => 'application/json'} +response = URI.open(${1:url}, headers) +body = JSON.parse(response.read) +endsnippet