test_joska 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Gemfile.lock +1 -1
- data/lib/test_joska/builder.rb +31 -19
- data/lib/test_joska/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52e9d7e407c75796701be26159208426df74e70d06dacd3d2cea98719ec14392
|
4
|
+
data.tar.gz: b31b8f067351ca5343a311547c35458fe10c9764c79ccf6a3bcc699b65f9b886
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ded54b55b7d4c951fc3a612c176ff3b060c011a6233e22f29a8b06033bfc26b527fb3cc9cba42b6cbef05576eae3b89b022ec809e8bc4b02c7ff1bafc610ccd7
|
7
|
+
data.tar.gz: 40d4b8b1deb7b860bdb88d4f6cdf978e2470f65ebd3dd8605fb436189ef9293cad26395ff4eca694f71fae8029766ca5b99bf4ec9d04a38d96b01e6b246a4d09
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
data/lib/test_joska/builder.rb
CHANGED
@@ -1,22 +1,34 @@
|
|
1
1
|
module TestJoska
|
2
2
|
|
3
|
+
@@raise_on_error = false
|
4
|
+
|
5
|
+
@@output_url = false
|
6
|
+
|
7
|
+
@@URL = {}
|
8
|
+
|
9
|
+
@@HEAD = {}
|
10
|
+
|
11
|
+
@@standard_endpoint = ""
|
12
|
+
|
13
|
+
@@standard_environment = ""
|
14
|
+
|
3
15
|
@@internal_log = "log"
|
4
16
|
|
5
|
-
|
17
|
+
def jsk_setup(options)
|
6
18
|
|
7
|
-
|
19
|
+
@@raise_on_error = options["raise_on_error"]
|
8
20
|
|
9
|
-
|
21
|
+
@@output_url = options["output_url"]
|
10
22
|
|
11
|
-
|
23
|
+
@@URL = options["url_parts"]
|
12
24
|
|
13
|
-
|
25
|
+
@@HEAD = options["headers"]
|
14
26
|
|
15
|
-
|
27
|
+
@@standard_endpoint = options["standard_endpoint"]
|
16
28
|
|
17
|
-
|
29
|
+
@@standard_environment = options["standard_environment"]
|
18
30
|
|
19
|
-
|
31
|
+
end
|
20
32
|
|
21
33
|
def jsk_get_log
|
22
34
|
|
@@ -38,23 +50,23 @@ module TestJoska
|
|
38
50
|
|
39
51
|
def jsk_get_url_log
|
40
52
|
|
41
|
-
return
|
53
|
+
return @@url_log
|
42
54
|
|
43
55
|
end
|
44
56
|
|
45
57
|
def jsk_clear_url_log
|
46
58
|
|
47
|
-
|
59
|
+
@@url_log = ""
|
48
60
|
|
49
61
|
end
|
50
62
|
|
51
63
|
def request(method, product, type, details=nil, payload=nil, header_type=nil, endpoint=nil, env=nil)
|
52
64
|
|
53
|
-
endpoint = endpoint ? endpoint :
|
65
|
+
endpoint = endpoint ? endpoint : @@standard_endpoint
|
54
66
|
|
55
67
|
url = urlBuilder(product, type, details, endpoint, env)
|
56
68
|
|
57
|
-
header_type ? header =
|
69
|
+
header_type ? header = @@HEAD[header_type] : header = @@HEAD[endpoint]
|
58
70
|
|
59
71
|
payload = payload.to_json if payload
|
60
72
|
|
@@ -62,9 +74,9 @@ module TestJoska
|
|
62
74
|
|
63
75
|
p url
|
64
76
|
|
65
|
-
|
77
|
+
@@url_log = "#{@@url_log}\n#{method} #{type}: #{url}"
|
66
78
|
|
67
|
-
|
79
|
+
@@url_log = "#{@@url_log}\nPayload: #{payload}" if payload && type != "login"
|
68
80
|
|
69
81
|
RestClient::Request.execute(method: method, url: url, headers: header, payload: payload, timeout: 90) do |response|
|
70
82
|
|
@@ -102,23 +114,23 @@ module TestJoska
|
|
102
114
|
|
103
115
|
def urlBuilder(product, type, details, endpoint, env=nil)
|
104
116
|
|
105
|
-
env = env ? env :
|
117
|
+
env = env ? env : @@standard_environment
|
106
118
|
|
107
119
|
details = "" if !details
|
108
120
|
|
109
121
|
details = [details] if !details.kind_of?(Array)
|
110
122
|
|
111
|
-
url =
|
123
|
+
url = @@URL[product]["base"]["#{env}_#{endpoint}"]
|
112
124
|
|
113
|
-
if
|
125
|
+
if !@@URL[product]["path"][type].kind_of?(Array)
|
114
126
|
|
115
|
-
return "#{url}#{
|
127
|
+
return "#{url}#{@@URL[product]["path"][type]}#{details[0]}"
|
116
128
|
|
117
129
|
else
|
118
130
|
|
119
131
|
query_pos = 0
|
120
132
|
|
121
|
-
|
133
|
+
@@URL[product]["path"][type].each do |query|
|
122
134
|
|
123
135
|
if details[query_pos] && details[query_pos] != ""
|
124
136
|
|
data/lib/test_joska/version.rb
CHANGED