safrano 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/multipart.rb +0 -1
- data/lib/odata/collection.rb +2 -1
- data/lib/odata/collection_order.rb +3 -1
- data/lib/odata/entity.rb +1 -1
- data/lib/odata/url_parameters.rb +1 -0
- data/lib/sequel/plugins/join_by_paths.rb +1 -0
- data/lib/service.rb +30 -18
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '068df72ed0e610de674a7f8771f1ff4e5a8e1d4217c5755c08bab78e3c735588'
|
4
|
+
data.tar.gz: e45fc20c09b7717c1354e80c9e7afd6b4e71a0b27cc97c99b2fd51b99abcb083
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 709fe03f7939265381c276192a1db812a26a55a14914de89ae220f37b99efe21ed057f05c0e071bb388eef21c01df9a8408557aca6bc19e30a2767752f7d39f4
|
7
|
+
data.tar.gz: b4fb2033ec0fd0568c23762cbf660f36e879574367c61617c022847fee64747762943139eb91849f8ae762182688c7e424db5545539e1f7896e10c3e6db62113
|
data/lib/multipart.rb
CHANGED
data/lib/odata/collection.rb
CHANGED
data/lib/odata/entity.rb
CHANGED
data/lib/odata/url_parameters.rb
CHANGED
data/lib/service.rb
CHANGED
@@ -31,6 +31,21 @@ module OData
|
|
31
31
|
yield k, rest_exp
|
32
32
|
end
|
33
33
|
|
34
|
+
# default v2
|
35
|
+
# overriden in ServiceV1
|
36
|
+
def get_coll_odata_h(array:, expand: nil, uribase:, icount: nil)
|
37
|
+
res = array.map do |w|
|
38
|
+
get_entity_odata_h(entity: w,
|
39
|
+
expand: expand,
|
40
|
+
uribase: uribase)
|
41
|
+
end
|
42
|
+
if icount
|
43
|
+
{ 'results' => res, '__count' => icount }
|
44
|
+
else
|
45
|
+
{ 'results' => res }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
34
49
|
# handle a single expand
|
35
50
|
def handle_entity_expand_one(entity:, exp_one:, nav_values_h:, nav_coll_h:,
|
36
51
|
uribase:)
|
@@ -42,11 +57,10 @@ module OData
|
|
42
57
|
uribase: uribase)
|
43
58
|
elsif (encoll = entity.nav_coll[first])
|
44
59
|
# nav attributes that are a collection (x..n)
|
45
|
-
nav_coll_h[first.to_s] = encoll
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end
|
60
|
+
nav_coll_h[first.to_s] = get_coll_odata_h(array: encoll,
|
61
|
+
expand: rest_exp,
|
62
|
+
uribase: uribase)
|
63
|
+
|
50
64
|
end
|
51
65
|
end
|
52
66
|
end
|
@@ -142,6 +156,9 @@ module OData
|
|
142
156
|
include XMLNS
|
143
157
|
# Base class for service. Subclass will be for V1, V2 etc...
|
144
158
|
class ServiceBase
|
159
|
+
include Safrano
|
160
|
+
include ExpandHandler
|
161
|
+
|
145
162
|
XML_PREAMBLE = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>' + \
|
146
163
|
"\r\n".freeze
|
147
164
|
|
@@ -318,9 +335,6 @@ module OData
|
|
318
335
|
@collections.map(&:entity_set_name).join('|')
|
319
336
|
end
|
320
337
|
|
321
|
-
include Safrano
|
322
|
-
include ExpandHandler
|
323
|
-
|
324
338
|
def service
|
325
339
|
hres = {}
|
326
340
|
hres['d'] = { 'EntitySets' => @collections.map(&:type_name) }
|
@@ -496,6 +510,12 @@ module OData
|
|
496
510
|
@data_service_version = '1.0'
|
497
511
|
end
|
498
512
|
|
513
|
+
def get_coll_odata_links_h(array:, uribase:, icount: nil)
|
514
|
+
array.map do |w|
|
515
|
+
get_entity_odata_link_h(entity: w, uribase: uribase)
|
516
|
+
end
|
517
|
+
end
|
518
|
+
|
499
519
|
def get_coll_odata_h(array:, expand: nil, uribase:, icount: nil)
|
500
520
|
array.map do |w|
|
501
521
|
get_entity_odata_h(entity: w,
|
@@ -515,17 +535,9 @@ module OData
|
|
515
535
|
@data_service_version = '2.0'
|
516
536
|
end
|
517
537
|
|
518
|
-
def get_coll_odata_links_h(array:, uribase:)
|
519
|
-
array.map do |w|
|
520
|
-
get_entity_odata_link_h(entity: w, uribase: uribase)
|
521
|
-
end
|
522
|
-
end
|
523
|
-
|
524
|
-
def get_coll_odata_h(array:, expand: nil, uribase:, icount: nil)
|
538
|
+
def get_coll_odata_links_h(array:, uribase:, icount: nil)
|
525
539
|
res = array.map do |w|
|
526
|
-
|
527
|
-
expand: expand,
|
528
|
-
uribase: uribase)
|
540
|
+
get_entity_odata_link_h(entity: w, uribase: uribase)
|
529
541
|
end
|
530
542
|
if icount
|
531
543
|
{ 'results' => res, '__count' => icount }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: safrano
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- D.M.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|