json_data_extractor 0.0.7 → 0.0.8

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: dcd400b724a3b0afebdb95df4ce66929b047a2b13d20be1c377caf1f207288a5
4
- data.tar.gz: ef17fc111fcc824c7b8a54a156b65a91982c6e06883823cfc57521221d541498
3
+ metadata.gz: ac39771f7b1358e30e26bfdc81b5b4ad5ac493238e84142e31331648f96fa37e
4
+ data.tar.gz: 69a0d03f65e05dfb292ae01f950986822ec04991771968ede64c63c6f202d99f
5
5
  SHA512:
6
- metadata.gz: d2a2c513cc9c18b6500bb3b04b48b67d7559966eab4b63d0254bdeb3c8a732ac667b490df4dcc764277417fb242f8c61fa8cf9b8285c22bf2dd556c995eb0d8f
7
- data.tar.gz: ebb5c2011ef2a188a393aa452250b8034a6c9fc2c7223cbdc2cba32d722fa1504871cd2fd8a75abb5767a4c4832a6e246579578c1a3e12216f501f641dde860b
6
+ metadata.gz: 403b5b95e7bfc0b7f530021980a10407f08be499092a80550a2dc55df7aeabc64197f68e6bf44f98c19be4ea8d57884db1205490970a57552ea924cf673c0f8a
7
+ data.tar.gz: 58260729ea70e88fdd1937cbbac0cffac998ce9dab686dedbbcb110e7618edd72a9bd71e494bfdc7441665a306e3ead800d9558b4c80b2fce525de3c70f90eee
data/README.md CHANGED
@@ -125,18 +125,18 @@ JDE supports nested schemas. Just provide your element with a type of `array` an
125
125
 
126
126
  E.g. this is a valid real-life schema with nested data:
127
127
 
128
- ```ruby
128
+ ```json
129
129
  {
130
- name: '$.Name',
131
- code: '$.Code',
132
- services: '$.Services[*].Code',
133
- locations: {
134
- path: '$.Locations[*]',
135
- type: 'array',
136
- schema: {
137
- name: '$.Name',
138
- type: '$.Type',
139
- code: '$.Code'
130
+ "name": "$.Name",
131
+ "code": "$.Code",
132
+ "services": "$.Services[*].Code",
133
+ "locations": {
134
+ "path": "$.Locations[*]",
135
+ "type": "array",
136
+ "schema": {
137
+ "name": "$.Name",
138
+ "type": "$.Type",
139
+ "code": "$.Code"
140
140
  }
141
141
  }
142
142
  }
@@ -39,7 +39,13 @@ class JsonDataExtractor
39
39
 
40
40
  # TODO yeah, this looks ugly. Address it later.
41
41
  if !array_type
42
- results[key] = results[key].first unless 1 < results[key].size
42
+ if nested
43
+ results[key] = self.class.new(results[key].first, @modifiers).extract(nested)
44
+ # todo there might be a problem if results[key] yields more than 1 item
45
+ # Yeah, we'll get back to it later. Or send your PRs
46
+ else
47
+ results[key] = results[key].first unless 1 < results[key].size
48
+ end
43
49
  elsif nested
44
50
  results[key] = []
45
51
  Array(extracted_data).each do |item|
data/lib/src/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class JsonDataExtractor
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_data_extractor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Max Buslaev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-10 00:00:00.000000000 Z
11
+ date: 2023-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
136
136
  - !ruby/object:Gem::Version
137
137
  version: '0'
138
138
  requirements: []
139
- rubygems_version: 3.0.3
139
+ rubygems_version: 3.2.3
140
140
  signing_key:
141
141
  specification_version: 4
142
142
  summary: Transform JSON data structures with the help of a simple schema and JsonPath