safrano 0.3.2 → 0.4.2
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/odata/attribute.rb +1 -1
- data/lib/odata/batch.rb +24 -10
- data/lib/odata/collection.rb +242 -96
- data/lib/odata/collection_filter.rb +40 -9
- data/lib/odata/collection_media.rb +279 -0
- data/lib/odata/collection_order.rb +46 -36
- data/lib/odata/common_logger.rb +59 -0
- data/lib/odata/entity.rb +268 -54
- data/lib/odata/error.rb +58 -17
- data/lib/odata/expand.rb +123 -0
- data/lib/odata/filter/error.rb +6 -0
- data/lib/odata/filter/parse.rb +4 -12
- data/lib/odata/filter/sequel.rb +11 -13
- data/lib/odata/filter/tree.rb +11 -15
- data/lib/odata/navigation_attribute.rb +150 -0
- data/lib/odata/relations.rb +2 -2
- data/lib/odata/select.rb +42 -0
- data/lib/odata/url_parameters.rb +51 -36
- data/lib/odata/walker.rb +12 -4
- data/lib/safrano.rb +23 -12
- data/lib/{safrano_core.rb → safrano/core.rb} +14 -3
- data/lib/{multipart.rb → safrano/multipart.rb} +51 -29
- data/lib/{odata_rack_builder.rb → safrano/odata_rack_builder.rb} +1 -1
- data/lib/{rack_app.rb → safrano/rack_app.rb} +15 -10
- data/lib/{request.rb → safrano/request.rb} +21 -8
- data/lib/{response.rb → safrano/response.rb} +1 -2
- data/lib/{sequel_join_by_paths.rb → safrano/sequel_join_by_paths.rb} +1 -1
- data/lib/{service.rb → safrano/service.rb} +93 -97
- data/lib/safrano/version.rb +3 -0
- data/lib/sequel/plugins/join_by_paths.rb +11 -10
- metadata +34 -15
@@ -23,7 +23,6 @@ class String
|
|
23
23
|
end
|
24
24
|
|
25
25
|
class PathNode < String
|
26
|
-
attr_reader :table_name
|
27
26
|
attr_accessor :model_class
|
28
27
|
attr_accessor :path_str
|
29
28
|
def initialize(str, start_model)
|
@@ -80,14 +79,14 @@ class QPath
|
|
80
79
|
path_nodes = []
|
81
80
|
start_node.path_str = path_str
|
82
81
|
nodes = [start_node]
|
83
|
-
nodes.concat
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
82
|
+
nodes.concat(@qpath.split('/').map { |nstr| @start_model.create_path_node(nstr) })
|
83
|
+
return unless nodes.size > 1
|
84
|
+
|
85
|
+
nodes[0...-1].each_with_index do |node, i|
|
86
|
+
nodes[i + 1].set_model_class_by_parent_model(node.model_class)
|
87
|
+
path_nodes << nodes[i + 1]
|
88
|
+
nodes[i + 1].path_str = path_nodes.join('/')
|
89
|
+
@segments << [node, nodes[i + 1]]
|
91
90
|
end
|
92
91
|
end
|
93
92
|
end
|
@@ -95,6 +94,7 @@ end
|
|
95
94
|
class JoinByPathsHelper < Set
|
96
95
|
attr_reader :result
|
97
96
|
attr_reader :start_model
|
97
|
+
EMPTY_ARRAY = [].freeze
|
98
98
|
|
99
99
|
def initialize(smodel)
|
100
100
|
super()
|
@@ -102,7 +102,7 @@ class JoinByPathsHelper < Set
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def build_unique_join_segments
|
105
|
-
return (@result =
|
105
|
+
return (@result = EMPTY_ARRAY) if empty?
|
106
106
|
|
107
107
|
maxlen = map(&:size).max
|
108
108
|
iset = nil
|
@@ -118,6 +118,7 @@ class JoinByPathsHelper < Set
|
|
118
118
|
jseg.map do |seg|
|
119
119
|
leftm = seg.first.model_class
|
120
120
|
assoc = leftm.association_reflection(seg.last.to_sym)
|
121
|
+
|
121
122
|
rightm = seg.last.model_class
|
122
123
|
# cf. documentation in sequel/model/associations.rb
|
123
124
|
case assoc[:type]
|
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.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- D.M.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.15'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rfc2047
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,37 +108,43 @@ dependencies:
|
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0.51'
|
97
|
-
description: Safrano is an OData server
|
98
|
-
email:
|
111
|
+
description: Safrano is an OData server library based on Ruby, Rack and Sequel.
|
112
|
+
email: dev@aithscel.eu
|
99
113
|
executables: []
|
100
114
|
extensions: []
|
101
115
|
extra_rdoc_files: []
|
102
116
|
files:
|
103
|
-
- lib/multipart.rb
|
104
117
|
- lib/odata/attribute.rb
|
105
118
|
- lib/odata/batch.rb
|
106
119
|
- lib/odata/collection.rb
|
107
120
|
- lib/odata/collection_filter.rb
|
121
|
+
- lib/odata/collection_media.rb
|
108
122
|
- lib/odata/collection_order.rb
|
123
|
+
- lib/odata/common_logger.rb
|
109
124
|
- lib/odata/entity.rb
|
110
125
|
- lib/odata/error.rb
|
126
|
+
- lib/odata/expand.rb
|
111
127
|
- lib/odata/filter/error.rb
|
112
128
|
- lib/odata/filter/parse.rb
|
113
129
|
- lib/odata/filter/sequel.rb
|
114
130
|
- lib/odata/filter/token.rb
|
115
131
|
- lib/odata/filter/tree.rb
|
132
|
+
- lib/odata/navigation_attribute.rb
|
116
133
|
- lib/odata/relations.rb
|
134
|
+
- lib/odata/select.rb
|
117
135
|
- lib/odata/url_parameters.rb
|
118
136
|
- lib/odata/walker.rb
|
119
|
-
- lib/odata_rack_builder.rb
|
120
|
-
- lib/rack_app.rb
|
121
|
-
- lib/request.rb
|
122
|
-
- lib/response.rb
|
123
137
|
- lib/safrano.rb
|
124
|
-
- lib/
|
138
|
+
- lib/safrano/core.rb
|
139
|
+
- lib/safrano/multipart.rb
|
140
|
+
- lib/safrano/odata_rack_builder.rb
|
141
|
+
- lib/safrano/rack_app.rb
|
142
|
+
- lib/safrano/request.rb
|
143
|
+
- lib/safrano/response.rb
|
144
|
+
- lib/safrano/sequel_join_by_paths.rb
|
145
|
+
- lib/safrano/service.rb
|
146
|
+
- lib/safrano/version.rb
|
125
147
|
- lib/sequel/plugins/join_by_paths.rb
|
126
|
-
- lib/sequel_join_by_paths.rb
|
127
|
-
- lib/service.rb
|
128
148
|
homepage: https://gitlab.com/dm0da/safrano
|
129
149
|
licenses:
|
130
150
|
- MIT
|
@@ -148,9 +168,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
168
|
- !ruby/object:Gem::Version
|
149
169
|
version: '0'
|
150
170
|
requirements: []
|
151
|
-
|
152
|
-
rubygems_version: 2.7.6.2
|
171
|
+
rubygems_version: 3.1.2
|
153
172
|
signing_key:
|
154
173
|
specification_version: 4
|
155
|
-
summary: Safrano is a Ruby
|
174
|
+
summary: Safrano is a Ruby OData server library based on Sequel and Rack
|
156
175
|
test_files: []
|