service_contract_webmock 0.1.8 → 0.1.9

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: c3e3ff189924717e8daa4ec91149d6b649e57c60
4
- data.tar.gz: ba72e67586fcc467d8968b27be145fc6a9be3627
3
+ metadata.gz: 4e7ebbb5cf842f5d26df4c4c4ff1655e7b1e20e8
4
+ data.tar.gz: b9e05ddd192b85dce819a097cb746ee8222180c6
5
5
  SHA512:
6
- metadata.gz: ceeb6027c806503401ab69ce1818dbb77b315ca17107dae1275ab52e2413539aeecc57b9c3cff2816ed8b0abca4dc70f20dabe1e4a1f78702f8922680fee26ed
7
- data.tar.gz: 886a6c340bb77ea85b003914af9bda269c7f0992f4bedf6456902a3d6dd96b23cd40668a196450729a57f9dba8bfa7964a260f3003d6d8f8ebf268a2a464852c
6
+ metadata.gz: 94a3625f7da312b7ce27499188189f78a8b9da04ef982747d133733a9df2830eff8ee7b8f621b315a11b514df7a8bffe98019c242bb0767d015ca968b03bcac1
7
+ data.tar.gz: caaec48acb0deed3686c28e963532a3621dfda288a423838ce947e2d0e0edeb32beabe59b6743f9603c54fd1f3b09890155746585c8200f155523ec9ce8d10da
@@ -54,6 +54,12 @@ module ServiceContractWebmock
54
54
  end
55
55
 
56
56
  def found(query)
57
+ records = do_search(query)
58
+
59
+ apply_pagination(records, query)
60
+ end
61
+
62
+ def do_search(query)
57
63
  search = extract_request(query)
58
64
  if search.empty?
59
65
  resources
@@ -66,5 +72,14 @@ module ServiceContractWebmock
66
72
  end
67
73
  end
68
74
  end
75
+
76
+ def apply_pagination(records, query)
77
+ params = CGI.parse(query)
78
+ if params["per_page"].present? && params["per_page"].first.present?
79
+ per_page = params["per_page"].first.to_i
80
+ records = records.take(per_page)
81
+ end
82
+ records
83
+ end
69
84
  end
70
85
  end
@@ -1,3 +1,3 @@
1
1
  module ServiceContractWebmock
2
- VERSION = "0.1.8"
2
+ VERSION = "0.1.9"
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.8
4
+ version: 0.1.9
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-06-22 00:00:00.000000000 Z
11
+ date: 2017-06-05 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.5.1
139
+ rubygems_version: 2.4.5.1
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: A library for generating webmock mocks with ServiceContract schemas