Module: Gorillapi::CurlBuilder
- Included in:
- RequestBuilder
- Defined in:
- lib/gorillapi/curl_builder.rb
Instance Method Summary collapse
- #accept ⇒ Object
- #add_params ⇒ Object
- #authorization ⇒ Object
- #content_header ⇒ Object
- #host ⇒ Object
- #request_string ⇒ Object
Instance Method Details
#accept ⇒ Object
14 15 16 |
# File 'lib/gorillapi/curl_builder.rb', line 14 def accept "-H \"Accept: #{accept_header}\"" end |
#add_params ⇒ Object
22 23 24 |
# File 'lib/gorillapi/curl_builder.rb', line 22 def add_params "-d '#{params.to_json}'" unless params.nil? || params.empty? || params == '' end |
#authorization ⇒ Object
10 11 12 |
# File 'lib/gorillapi/curl_builder.rb', line 10 def "-H \"AUTHORIZATION: #{token}\"" end |
#content_header ⇒ Object
18 19 20 |
# File 'lib/gorillapi/curl_builder.rb', line 18 def content_header "-H \"Content-Type: #{content_type}\"" end |
#host ⇒ Object
26 27 28 |
# File 'lib/gorillapi/curl_builder.rb', line 26 def host "http://#{url}#{path}" end |
#request_string ⇒ Object
4 5 6 7 8 |
# File 'lib/gorillapi/curl_builder.rb', line 4 def request_string <<-EOF curl -X #{request_method} -k -i -v #{content_header} #{accept} #{} #{add_params} #{host} EOF end |