Class: RequestCurlFormatter
Instance Method Summary
collapse
#generate, #initialize, #to_s
Instance Method Details
#begin_section(_) ⇒ Object
38
39
40
|
# File 'lib/dtracer/request_formatters.rb', line 38
def begin_section(_)
["curl"]
end
|
#body_section(hash) ⇒ Object
62
63
64
65
66
|
# File 'lib/dtracer/request_formatters.rb', line 62
def body_section(hash)
return nil unless hash["body"]
["-d #{hash["body"]}"]
end
|
#cookie_section(hash) ⇒ Object
56
57
58
59
60
|
# File 'lib/dtracer/request_formatters.rb', line 56
def cookie_section(hash)
return nil unless hash["cookies"]
hash["cookies"].map { |name, value| "--cookie \"#{name}=#{value}\"" }
end
|
50
51
52
53
54
|
# File 'lib/dtracer/request_formatters.rb', line 50
def (hash)
return nil unless hash["headers"]
hash["headers"].map { |key, value| "-H '#{key}: #{value}'" }
end
|
#joining_string ⇒ Object
34
35
36
|
# File 'lib/dtracer/request_formatters.rb', line 34
def joining_string
" \\ \n"
end
|
#method_section(hash) ⇒ Object
42
43
44
|
# File 'lib/dtracer/request_formatters.rb', line 42
def method_section(hash)
["-X #{hash["method"]}"]
end
|
#url_section(hash) ⇒ Object
46
47
48
|
# File 'lib/dtracer/request_formatters.rb', line 46
def url_section(hash)
["\"#{hash["url"]}\""]
end
|