webspicy 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25bddf1bd20435c789246fa3623ac1a176e0ce1b
4
- data.tar.gz: cb26e4c6cbdd84bffacf0f177b522f2ea4c2a63c
3
+ metadata.gz: 664e519735fcd77f635cd462563320baba79481e
4
+ data.tar.gz: c1f0002111073477a9503a2df78901f4f6f5cb5a
5
5
  SHA512:
6
- metadata.gz: be56f479d2e55abe57bfbb626e36087f67a4313da8f0a7218d959597ab5f27782d92aa814fc2a1d4ef688e7e964a3b9ecc27e86e46f8135019cb7d99dbd2842d
7
- data.tar.gz: dc1011652cfae76a9218bc7f6f805883ebab5b467699bad24b8d35097774d4e6ce70b85217dcfe220a4878b9b1329ac491c5e5ba30cb269a76838c8c68fbe168
6
+ metadata.gz: 707569be3cf76e783c82610c791f560bde7a849b742342e42f37e867f669966b05fbc44c52de49444a5cfac777480e98cf37d05620768e52e6d8edab6b3df4ac
7
+ data.tar.gz: ba6f158b152a33d79ab220c08c66d0b1dd2b71fa11d288876d8c53f40cc20f67a74a7428e7eb02433048aee8dfed924281532c50424fed2a3c66ab6e65802497
@@ -54,14 +54,14 @@ module Webspicy
54
54
  attr_reader :last_response
55
55
 
56
56
  def initialize(app)
57
- @handler = RackHandler.new(app)
57
+ @app = app
58
58
  end
59
- attr_reader :handler
60
59
 
61
60
  def get(url, params = {}, headers = nil)
62
- Webspicy.info("GET #{url} -- #{params.inspect}")
61
+ handler = get_handler(headers)
62
+
63
+ Webspicy.info("GET #{url} -- #{params.inspect} -- #{headers.inspect}")
63
64
 
64
- install_headers(headers) if headers
65
65
  handler.get(url, params)
66
66
  @last_response = handler.last_response
67
67
 
@@ -70,9 +70,10 @@ module Webspicy
70
70
  end
71
71
 
72
72
  def post(url, params = {}, headers = nil)
73
- Webspicy.info("POST #{url} -- #{params.inspect}")
73
+ handler = get_handler(headers)
74
+
75
+ Webspicy.info("POST #{url} -- #{params.inspect} -- #{headers.inspect}")
74
76
 
75
- install_headers(headers) if headers
76
77
  handler.post(url, params.to_json, {"CONTENT_TYPE" => "application/json"})
77
78
  @last_response = handler.last_response
78
79
 
@@ -81,9 +82,10 @@ module Webspicy
81
82
  end
82
83
 
83
84
  def post_form(url, params = {}, headers = nil)
84
- Webspicy.info("POST #{url} -- #{params.inspect}")
85
+ handler = get_handler(headers)
86
+
87
+ Webspicy.info("POST #{url} -- #{params.inspect} -- #{headers.inspect}")
85
88
 
86
- install_headers(headers) if headers
87
89
  handler.post(url, params)
88
90
  @last_response = handler.last_response
89
91
 
@@ -92,9 +94,10 @@ module Webspicy
92
94
  end
93
95
 
94
96
  def delete(url, params = {}, headers = nil)
95
- Webspicy.info("DELETE #{url} -- #{params.inspect}")
97
+ handler = get_handler(headers)
98
+
99
+ Webspicy.info("DELETE #{url} -- #{params.inspect} -- #{headers.inspect}")
96
100
 
97
- install_headers(headers) if headers
98
101
  handler.delete(url, params.to_json, {"CONTENT_TYPE" => "application/json"})
99
102
  @last_response = handler.last_response
100
103
 
@@ -104,10 +107,12 @@ module Webspicy
104
107
 
105
108
  private
106
109
 
107
- def install_headers(hs)
110
+ def get_handler(hs)
111
+ handler = RackHandler.new(@app)
108
112
  hs.each_pair do |k,v|
109
113
  handler.header(k,v)
110
- end
114
+ end if hs
115
+ handler
111
116
  end
112
117
 
113
118
  end # class Api
@@ -2,7 +2,7 @@ module Webspicy
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 2
5
- TINY = 2
5
+ TINY = 3
6
6
  end
7
7
  VERSION = "#{Version::MAJOR}.#{Version::MINOR}.#{Version::TINY}"
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webspicy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau
@@ -174,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
174
174
  version: '0'
175
175
  requirements: []
176
176
  rubyforge_project:
177
- rubygems_version: 2.6.11
177
+ rubygems_version: 2.5.1
178
178
  signing_key:
179
179
  specification_version: 4
180
180
  summary: Webspicy helps testing web services as software operation black boxes!