service_contract_webmock 0.1.1 → 0.1.2

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: c2f46883b4ec5fe2bdebd19249e0461c52015e9b
4
- data.tar.gz: fa761f30620e2c18e2168cfda5b353bc84ac805d
3
+ metadata.gz: 11e94ef90e0b95a1415b6d0340d3ea1ed0c3e537
4
+ data.tar.gz: ac56ce5e885f789f8bdabfd05251bdee55e6abf6
5
5
  SHA512:
6
- metadata.gz: a7a4c6db34f1790f5e6ad99496ac19c7a813d2d5fde34baa7b172fe049fb206c852a7b14cb41708b41494a92470a62c788662ec11a0eb29b54a1d381f3ca76ba
7
- data.tar.gz: 9843ea2e75a6284db12b32f25db06dbcbb8e44657f2cae321164800d25482f3e79b7b474e10ae22c1b0fb76f310e839d489da70433a570296705fe858afed145
6
+ metadata.gz: 668096ebf82b0320aad1163e53c3f36d532f09196d1430501b28b467989072379fff995e34365c35ed4ac17ec3a57323ff7246b1e827502c0f5a17b0d797c95a
7
+ data.tar.gz: 54dc1afd7046a5cbbe41220a042aef83c854ca7ba71934f44c571cf24ea72d707c52a20ea855f87b003daec0c98cbf469295ee82530f0118d51978fa025a3d63
@@ -13,19 +13,26 @@ module ServiceContractWebmock
13
13
  INT = Avro::Schema::PrimitiveSchema.new(:int)
14
14
 
15
15
  def to_regex
16
- params = (fields + [Field.new('page', INT), Field.new('per_page', INT)]).map do |field|
16
+ params = fields_and_pagination.map do |field|
17
17
  "#{field.name}=#{field.value}&?"
18
18
  end.join("|")
19
19
  "(#{params})+"
20
20
  end
21
21
 
22
+ def fields_and_pagination
23
+ fields + pagination_fields
24
+ end
25
+
26
+ def pagination_fields
27
+ [Field.new('page', INT), Field.new('per_page', INT)]
28
+ end
22
29
 
23
30
  def fields
24
31
  @fields ||= endpoint.parameters.map do |param|
25
32
  param.type.definition.fields.map do |field|
26
- Field.new(field.name, field.type)
33
+ Field.new(field.name, field.type) unless ['page', 'per_page'].include?(field.name)
27
34
  end
28
- end.flatten
35
+ end.flatten.compact
29
36
  end
30
37
 
31
38
  def field_int?(name)
@@ -1,3 +1,3 @@
1
1
  module ServiceContractWebmock
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_contract_webmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Plummer