service_contract_webmock 0.1.1 → 0.1.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11e94ef90e0b95a1415b6d0340d3ea1ed0c3e537
|
4
|
+
data.tar.gz: ac56ce5e885f789f8bdabfd05251bdee55e6abf6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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)
|