json_data_extractor 0.0.3 → 0.0.5

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: 101c20f78189fbd300dedf5a03779d19558d65fb4f4d2d4767ec8b1f638aafde
4
- data.tar.gz: 924d26135a261281c14051ab7aa305debcec61688fd6deda4aeb322da8028ecd
3
+ metadata.gz: 892319b2cab325e75d0e1350c2f6e58e01ecf4ca5cee5ba1228193a51f99e3ca
4
+ data.tar.gz: 9eba5d4e93b559d8ea59300dcd41f0188dc03ac72c5152e78c3a3d9e4b730781
5
5
  SHA512:
6
- metadata.gz: df55bd36b0e00ac0bd4f427451dcf69425538dc06382632b261ec03aaa6cb24b0648873645b80c609b1e7329e3f9aac85fa97612afdcc492efb6efa91d062f83
7
- data.tar.gz: df3a0c646a823792fa1bce461cab8eeb037b6be9906fbb1f5608cf69da4e13133c11f2e71aa90033b3924ea4ccc11f6a9900ca17b263c44702583c6eb3b679fa
6
+ metadata.gz: 05e7e6c2f863b4f1e62d9558b5c670cc8e7eac0398bb150c1f5a71865e25492417d6c9efd8699bfce27ef576fb58a81aa20386cb3af37faee6d599a46466667b
7
+ data.tar.gz: 66ccf6ba5a410b92c8e4ba1268b27d3c5c4797c61cda7185fc832cf26c6d4bc13f97d157873f6030a5889df5712df94ef365387053cd054131b568e239c90825
@@ -1,4 +1,5 @@
1
- require "src/version"
1
+ require 'src/version'
2
+ require 'jsonpath'
2
3
 
3
4
  class JsonDataExtractor
4
5
  attr_reader :data, :modifiers
@@ -23,14 +24,13 @@ class JsonDataExtractor
23
24
  path = val[:path]
24
25
  modifiers = Array(val[:modifiers] || val[:modifier]).map(&:to_sym)
25
26
  array_type = 'array' == val[:type]
26
- nested = val.delete(:schema)
27
+ nested = val.dup.delete(:schema)
27
28
  else
28
29
  path = val
29
30
  modifiers = []
30
31
  end
31
32
 
32
- json_path = JsonPath.new(path)
33
- extracted_data = json_path.on(@data)
33
+ extracted_data = JsonPath.on(@data, path)
34
34
 
35
35
  if extracted_data.empty?
36
36
  results[key] = nil
data/lib/src/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class JsonDataExtractor
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_data_extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Buslaev