We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aaf1d20 commit 21e537fCopy full SHA for 21e537f
any_num_param.rb
@@ -0,0 +1,26 @@
1
+def get_data(url, headers = {}, *params)
2
+ puts "calling #{url}"
3
+ if headers.length > 0
4
+ puts "headers: #{headers}"
5
+ else
6
+ puts "no headers"
7
+ end
8
+ params.each do |param|
9
+ puts "found param: #{param}"
10
11
+end
12
+
13
+def assemble_params(inlude_headers = false, include_date = false, only_show_my_records = true)
14
+ headers = {accept: "application/json"}
15
+ url = "https://exampleapi.com"
16
+ args = [url]
17
+ args << headers if inlude_headers
18
+ params = []
19
+ params << "date=#{Time.now}" if include_date
20
+ params << "myrecords=true" if only_show_my_records
21
+ args << params if params.length > 0
22
23
24
+# get_data(*assemble_params)
25
+# get_data(*assemble_params(true))
26
+get_data(*assemble_params(false,true,false))
0 commit comments