lapiz 1.0.0 → 1.0.1
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/lib/lapiz.rb +21 -3
- data/lib/lapiz/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0ab0b44e4874b9bdfc660a8a5aac8d713590293
|
4
|
+
data.tar.gz: 9d06ae27e0b93082aabb4c5a7f38ce21a969b1c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4b1ec0a78f21c60d0b38280c8601e374b03fb72172b2063dc63f7d02edddb3464e514016c9d249da59393eee255119a817098e8649f80efca6b7155a64f1a93
|
7
|
+
data.tar.gz: eb4b20fc26669e158fc1364461845e259f90810a5c8821bb3fecffeb4373faa6a7a4c237e6562b6ead964fca5107dd85309d0b8f79bae629da73794520751c78
|
data/lib/lapiz.rb
CHANGED
@@ -31,13 +31,13 @@ class Hash
|
|
31
31
|
end
|
32
32
|
|
33
33
|
new_hash = new_hash.to_a.map{ |e|
|
34
|
-
if e[0].include?(",")
|
34
|
+
if e[0].to_s.include?(",")
|
35
35
|
main = e[0].split(",").first
|
36
36
|
rest = e[0].split(",")[1..-1]
|
37
37
|
rest_string = rest.map{ |r| "[#{r}]" }.join("")
|
38
38
|
["#{main}#{rest_string}", e[1]]
|
39
39
|
else
|
40
|
-
e
|
40
|
+
[e[0].to_s, e[1]]
|
41
41
|
end
|
42
42
|
}.to_h
|
43
43
|
|
@@ -70,7 +70,25 @@ module Lapiz
|
|
70
70
|
http_call(:post, path, params, &block)
|
71
71
|
end
|
72
72
|
|
73
|
+
def patch(path, params, &block)
|
74
|
+
http_call(:patch, path, params, &block)
|
75
|
+
end
|
76
|
+
|
77
|
+
def put(path, params, &block)
|
78
|
+
http_call(:put, path, params, &block)
|
79
|
+
end
|
80
|
+
|
81
|
+
def delete(path, params, &block)
|
82
|
+
http_call(:delete, path, params, &block)
|
83
|
+
end
|
84
|
+
|
73
85
|
def http_call(method, path, params, &block)
|
86
|
+
if block.nil?
|
87
|
+
config = YAML.load(IO.read("config.yml"))
|
88
|
+
base_uri = config["server"]["base_uri"]
|
89
|
+
return HTTParty.send(method, base_uri + path, params)
|
90
|
+
end
|
91
|
+
|
74
92
|
it "tests action '#{path}'", self do |group|
|
75
93
|
expect {
|
76
94
|
@response = HTTParty.send(method, group.metadata[:base_uri] + path, params)
|
@@ -111,7 +129,7 @@ module Lapiz
|
|
111
129
|
end
|
112
130
|
end
|
113
131
|
|
114
|
-
if @response.body
|
132
|
+
if @response.body && (@response.code / 100 == 2)
|
115
133
|
fp.puts
|
116
134
|
fp.puts "+ Response #{@response.code} (#{@response.content_type})"
|
117
135
|
fp.puts
|
data/lib/lapiz/version.rb
CHANGED