salestation 4.6.1 → 5.0.0

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
  SHA256:
3
- metadata.gz: a1245b9d949f1d4f8cfb1ce04208f72cd4b0601e9bc798f65a86a83199deb1e1
4
- data.tar.gz: d35c8d0364840fb99a3667d007e9cc2ae9c80111bdd86b245f159ab337a98932
3
+ metadata.gz: 63f86b3537b2db5857f54ef439442a3ca0ef1a4f078d602989783814fd70b718
4
+ data.tar.gz: 2836da19672da049c461769c8482e4c9cab2e3ce6d6292293051639c0a0cb8e7
5
5
  SHA512:
6
- metadata.gz: c1fe8ec62ba1562d3ab7d24b96657c2eebc47c898e226f4a5af84050a3f839cdb850828e79da6caed07f958a3560881cf068690cff3f1c27fad55b12793c2c33
7
- data.tar.gz: be76d4e7151eeb1dcd378fd65c0f12d1c519cceb652eb8cb702f6db3692a7491e8190aecd0434fea27671b04ef379765fa062d1bffe91bd5c0ebeec0c0a5795c
6
+ metadata.gz: dc79ff3f36806274195543e4fc0e13f27d098d1239b3c0706cd6a7ed3f643a764a71b2b34426ccfbe19ebc9f29b0018a8c8619a1c2f9729c180df70a2b640906
7
+ data.tar.gz: 4b4d65d3e6158c9ff0025f2e5548b650dab2d0ca3bf4c5dca3f51b11943be552c44eadda05cb5830962157ef2d1200e8067b731eebbc74bb501d83e8a39d7753
@@ -197,12 +197,26 @@ module Salestation
197
197
  when Symbol
198
198
  stringified_key = filter.to_s
199
199
  extracted_data[filter] = request_hash[stringified_key] if request_hash.key?(stringified_key)
200
+ if extracted_data[filter].is_a?(Array)
201
+ extracted_data[filter] = extracted_data[filter].map{ |hash|
202
+ if hash.is_a?(Hash)
203
+ hash.transform_keys(&:to_sym) if hash.is_a?(Hash)
204
+ else
205
+ hash
206
+ end
207
+ }
208
+ end
200
209
  when Hash
201
210
  filter.each do |key, nested_filters|
202
211
  stringified_key = key.to_s
203
212
  if request_hash.key?(stringified_key)
204
213
  value = request_hash.fetch(stringified_key)
205
- extracted_data[key] = value.nil? ? nil : extract(nested_filters, value)
214
+ extracted_data[key] =
215
+ if !value.is_a?(Hash)
216
+ value
217
+ else
218
+ extract(nested_filters, value)
219
+ end
206
220
  end
207
221
  end
208
222
  end
@@ -219,17 +233,22 @@ module Salestation
219
233
  # Extracts and symbolizes params from request body
220
234
  #
221
235
  # @example
222
- # extractor = BodyParamExtractor[:x, :y, {foo: [:bar, :baz]}]
236
+ # extractor = BodyParamExtractor[:x, :y, {foo: [:bar, :baz]}, :aaa]
223
237
  # input = {
224
238
  # 'x' => '1',
225
239
  # 'y' => '2',
226
240
  # 'z' => '3',
227
241
  # 'foo' => {
228
242
  # 'bar' => 'qq'
229
- # }
243
+ # },
244
+ # 'aaa' => [
245
+ # {
246
+ # 'bb' => 'cc'
247
+ # }
248
+ # ]
230
249
  # }
231
250
  # # rack_request is Rack::Request with 'rack.request.form_hash' set to input
232
- # extractor.call(rack_request).value #=> {x: 1, y: 2, foo: {bar: 'qq}}
251
+ # extractor.call(rack_request).value #=> {x: 1, y: 2, foo: {bar: 'qq'}, aaa: [{bb: 'cc'}]}
233
252
  #
234
253
  class BodyParamExtractor
235
254
  def self.[](*filters)
data/salestation.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "salestation"
7
- spec.version = "4.6.1"
7
+ spec.version = "5.0.0"
8
8
  spec.authors = ["Glia TechMovers"]
9
9
  spec.email = ["techmovers@glia.com"]
10
10
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salestation
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.1
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Glia TechMovers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-27 00:00:00.000000000 Z
11
+ date: 2022-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler