Sha256: 4ba39ad86c5802cff8a1ef8b10a2f4ca1ca70047d38d3714e7b54884d8c859dc
Contents?: true
Size: 740 Bytes
Versions: 5
Compression:
Stored size: 740 Bytes
Contents
# frozen_string_literal: true module Icasework class Resource ## # Method to output a Icasework::Resource instance as a curl command: # module Curl def to_curl "curl #{curl_params}#{curl_auth}'#{url}'" end private def curl_auth auth_header = headers[:authorization] "-H 'Authorization: #{auth_header}' " if auth_header end def curl_params case method when :get return '-X GET ' if payload[:params].empty? "-G -d '#{URI.encode_www_form(payload[:params])}' " when :post return '-X POST ' if payload.empty? "-X POST -d '#{URI.encode_www_form(payload)}' " end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems