Class: RailsRequest::Payload
- Inherits:
-
Object
- Object
- RailsRequest::Payload
- Defined in:
- lib/rails_request/payload.rb
Instance Method Summary collapse
- #curl_options ⇒ Object
-
#initialize(payload) ⇒ Payload
constructor
A new instance of Payload.
- #method ⇒ Object
- #path ⇒ Object
Constructor Details
#initialize(payload) ⇒ Payload
Returns a new instance of Payload.
5 6 7 |
# File 'lib/rails_request/payload.rb', line 5 def initialize(payload) @payload = payload end |
Instance Method Details
#curl_options ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/rails_request/payload.rb', line 9 def query = params.present? ? "?#{params.to_query}" : nil # host and port set during request by before_action host = RailsRequest.host port = RailsRequest.port [ 'curl', '-v', "--request '#{method}'", headers.map { |key, value| "--header '#{key}: #{value}'" }, "'http://#{host}:#{port}#{path}#{query}'" ].flatten.join(" \\\n") end |
#method ⇒ Object
27 28 29 |
# File 'lib/rails_request/payload.rb', line 27 def method @payload[:method] end |
#path ⇒ Object
23 24 25 |
# File 'lib/rails_request/payload.rb', line 23 def path @payload[:path] end |