service_mock 0.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e9c6b2185d2d52eeda2b5b5a5487d766cdd9d7bc
4
- data.tar.gz: f4c1fd46633aafffd94ad7345be13785cc6f731a
3
+ metadata.gz: d0c8f7835468a570de6203c0123ec41598a86cad
4
+ data.tar.gz: 6e5684703af629bf3b141aaefd31af528e51647f
5
5
  SHA512:
6
- metadata.gz: f92c202ccdae0f705052dc2b0dfa198d7616bb9e26da55439eea0bb87661a057da039db7f5a800ba532313fdefb32269829565fcc3584da65e457667f8a77c11
7
- data.tar.gz: 5f8082f11c4bf0c7f1d798ff3d8a0e46ab0e63f6ce0e78bc9215a1f3b490664e8bcce32b593a22e1c5f108e7dc1cb03dbbd26a5500a949d403b615544a8706ef
6
+ metadata.gz: 45a99d300a1eb75fdff45a056464818c0a171b701e247d6d88b9dccf808fb1fed12bb87ff1fbf76bfd92511ee1740ae0f1b0c82d702e20f542f94ca90ac5b02c
7
+ data.tar.gz: b9018538106fc49a3e4af10da4075fe6e0ebf379036537b03e028d354b78023c8257448b0dd2db7e621857f9b8991018406b2f1ecb33dcfacdfdf9e53917e7ca
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ === Release 0.8 / 23-Sep-2017
2
+ * Added ability to provide proxy settings that are using when communicating with the server
3
+
1
4
  === Release 0.7.1 / 21-Aug-2017
2
5
  * Added ability to specify the stub creator file via Cucumber tags
3
6
  * Added count methods to retrieve the count for a specific request - thanks Jarl Friis
@@ -45,6 +45,7 @@ module ServiceMock
45
45
 
46
46
  attr_accessor :inherit_io, :wait_for_process, :remote_host, :classpath
47
47
  attr_reader :wiremock_version, :working_directory, :process
48
+ attr_accessor :proxy_addr, :proxy_port, :proxy_user, :proxy_pass
48
49
 
49
50
  def initialize(wiremock_version, working_directory = ::ServiceMock.working_directory)
50
51
  @wiremock_version = wiremock_version
@@ -139,7 +140,7 @@ module ServiceMock
139
140
  def count(request_criteria)
140
141
  return if ::ServiceMock.disable_stubs
141
142
  yield self if block_given?
142
- return JSON.parse(http.post('/__admin/requests/count', request_criteria).body)['count']
143
+ JSON.parse(http.post('/__admin/requests/count', request_criteria).body)['count']
143
144
  end
144
145
 
145
146
  #
@@ -149,7 +150,7 @@ module ServiceMock
149
150
  return if ::ServiceMock.disable_stubs
150
151
  yield self if block_given?
151
152
  content = File.open(filename, 'rb') { |file| file.read }
152
- return count(content)
153
+ count(content)
153
154
  end
154
155
 
155
156
  #
@@ -213,9 +214,17 @@ module ServiceMock
213
214
  end
214
215
 
215
216
  def http
217
+ if using_proxy
218
+ return Net::HTTP.Proxy(proxy_addr, proxy_port,
219
+ proxy_user, proxy_pass)
220
+ end
216
221
  Net::HTTP.new(admin_host, admin_port)
217
222
  end
218
223
 
224
+ def using_proxy
225
+ proxy_addr && proxy_port
226
+ end
227
+
219
228
  def admin_host
220
229
  return ENV['WIREMOCK_URL'].match(/http\:\/\/(.+)\:\d+/)[1] if ENV['WIREMOCK_URL']
221
230
  "#{remote_host ? remote_host : 'localhost'}"
@@ -1,3 +1,3 @@
1
1
  module ServiceMock
2
- VERSION = "0.7.1"
2
+ VERSION = "0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: '0.8'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeffrey S. Morgan
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-21 00:00:00.000000000 Z
11
+ date: 2017-09-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: childprocess