service_contract_webmock 0.1.3 → 0.1.4

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: c41852489b9c655a5cb871868b1ad5518f1a1bee
4
- data.tar.gz: 61a8018f84f24c09664e0c93c477d47277087c17
3
+ metadata.gz: d3698d16dde7ad4bc631d8e07819b3511955dd10
4
+ data.tar.gz: 182803a27a0d56229081db4330e6c10c4db93104
5
5
  SHA512:
6
- metadata.gz: 6ce21e58e6a0f1008653f5a3360e0b1cdd12adf6f63bd21d067714e4a16d6a6b70c7caecea36bc74bdf0207b5ea4a150bffd1899515f387d3e6a9659be12ec4a
7
- data.tar.gz: 6a00398b4994acede267e39c89362a7b340beac5254ff3add79d9445a1f10d345a5b86982075d5dc49103ac3d4366f8cb12f223a42d6cd3e2c32f8eb2534d8de
6
+ metadata.gz: bc2751b74fefeaa88b089298780b6090f177de71cc12abee6282e4d8b54073e2f9ae2ded512222141875a85c49352de4ee6bf1e1e7a302f902cd231e6dfe3495
7
+ data.tar.gz: 60f373676b7763d870e3be535f1150186fa54cff9ce440ab306237fcdd206a1deedd54ffd5c330ee9d261624a3392cad19f636504c1a11dca78581210e191bfc
@@ -29,8 +29,12 @@ module ServiceContractWebmock
29
29
 
30
30
  def fields
31
31
  @fields ||= endpoint.parameters.map do |param|
32
- param.type.definition.fields.map do |field|
33
- Field.new(field.name, field.type) unless ['page', 'per_page'].include?(field.name)
32
+ if param.type.definition.is_a?(Avro::Schema::PrimitiveSchema)
33
+ Field.new(param.name, param.type.definition)
34
+ else
35
+ param.type.definition.fields.map do |field|
36
+ Field.new(field.name, field.type) unless ['page', 'per_page'].include?(field.name)
37
+ end
34
38
  end
35
39
  end.flatten.compact
36
40
  end
@@ -43,6 +43,8 @@ module ServiceContractWebmock
43
43
  case type.items.type_sym
44
44
  when :int
45
45
  "[,\\d]+"
46
+ when :enum
47
+ "(#{type.items.symbols.map{|symbol| "#{symbol}(\..+)?"}.join("|")})"
46
48
  else
47
49
  raise "unhandled array subtype #{type.items.type_sym}"
48
50
  end
@@ -15,6 +15,7 @@ module ServiceContractWebmock
15
15
  stub_index_request
16
16
  stub_search_request
17
17
  stub_show_request
18
+ yield self if block_given?
18
19
  end
19
20
 
20
21
  def stub_request(method, path)
@@ -1,3 +1,3 @@
1
1
  module ServiceContractWebmock
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_contract_webmock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donald Plummer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-13 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avro
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  version: '0'
137
137
  requirements: []
138
138
  rubyforge_project:
139
- rubygems_version: 2.4.5.1
139
+ rubygems_version: 2.5.1
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: A library for generating webmock mocks with ServiceContract schemas