safrano 0.3.3 → 0.4.3
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 +9 -8
- data/lib/odata/batch.rb +8 -8
- data/lib/odata/collection.rb +239 -92
- data/lib/odata/collection_filter.rb +40 -9
- data/lib/odata/collection_media.rb +159 -28
- data/lib/odata/collection_order.rb +46 -36
- data/lib/odata/common_logger.rb +37 -12
- data/lib/odata/entity.rb +188 -99
- data/lib/odata/error.rb +60 -12
- data/lib/odata/expand.rb +123 -0
- data/lib/odata/filter/base.rb +66 -0
- data/lib/odata/filter/error.rb +33 -0
- data/lib/odata/filter/parse.rb +6 -12
- data/lib/odata/filter/sequel.rb +42 -29
- data/lib/odata/filter/sequel_function_adapter.rb +147 -0
- data/lib/odata/filter/token.rb +5 -1
- data/lib/odata/filter/tree.rb +45 -29
- data/lib/odata/navigation_attribute.rb +60 -27
- 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 +6 -6
- data/lib/safrano.rb +23 -13
- data/lib/{safrano_core.rb → safrano/core.rb} +12 -4
- data/lib/{multipart.rb → safrano/multipart.rb} +17 -26
- data/lib/{odata_rack_builder.rb → safrano/odata_rack_builder.rb} +0 -1
- data/lib/{rack_app.rb → safrano/rack_app.rb} +12 -10
- data/lib/{request.rb → safrano/request.rb} +8 -14
- 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} +162 -131
- data/lib/safrano/version.rb +3 -0
- data/lib/sequel/plugins/join_by_paths.rb +11 -10
- metadata +33 -16
- data/lib/version.rb +0 -4
@@ -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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- D.M.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-19 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,13 +108,12 @@ 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
|
@@ -110,25 +123,30 @@ files:
|
|
110
123
|
- lib/odata/common_logger.rb
|
111
124
|
- lib/odata/entity.rb
|
112
125
|
- lib/odata/error.rb
|
126
|
+
- lib/odata/expand.rb
|
127
|
+
- lib/odata/filter/base.rb
|
113
128
|
- lib/odata/filter/error.rb
|
114
129
|
- lib/odata/filter/parse.rb
|
115
130
|
- lib/odata/filter/sequel.rb
|
131
|
+
- lib/odata/filter/sequel_function_adapter.rb
|
116
132
|
- lib/odata/filter/token.rb
|
117
133
|
- lib/odata/filter/tree.rb
|
118
134
|
- lib/odata/navigation_attribute.rb
|
119
135
|
- lib/odata/relations.rb
|
136
|
+
- lib/odata/select.rb
|
120
137
|
- lib/odata/url_parameters.rb
|
121
138
|
- lib/odata/walker.rb
|
122
|
-
- lib/odata_rack_builder.rb
|
123
|
-
- lib/rack_app.rb
|
124
|
-
- lib/request.rb
|
125
|
-
- lib/response.rb
|
126
139
|
- lib/safrano.rb
|
127
|
-
- lib/
|
140
|
+
- lib/safrano/core.rb
|
141
|
+
- lib/safrano/multipart.rb
|
142
|
+
- lib/safrano/odata_rack_builder.rb
|
143
|
+
- lib/safrano/rack_app.rb
|
144
|
+
- lib/safrano/request.rb
|
145
|
+
- lib/safrano/response.rb
|
146
|
+
- lib/safrano/sequel_join_by_paths.rb
|
147
|
+
- lib/safrano/service.rb
|
148
|
+
- lib/safrano/version.rb
|
128
149
|
- lib/sequel/plugins/join_by_paths.rb
|
129
|
-
- lib/sequel_join_by_paths.rb
|
130
|
-
- lib/service.rb
|
131
|
-
- lib/version.rb
|
132
150
|
homepage: https://gitlab.com/dm0da/safrano
|
133
151
|
licenses:
|
134
152
|
- MIT
|
@@ -152,9 +170,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
170
|
- !ruby/object:Gem::Version
|
153
171
|
version: '0'
|
154
172
|
requirements: []
|
155
|
-
|
156
|
-
rubygems_version: 2.7.6.2
|
173
|
+
rubygems_version: 3.1.2
|
157
174
|
signing_key:
|
158
175
|
specification_version: 4
|
159
|
-
summary: Safrano is a Ruby
|
176
|
+
summary: Safrano is a Ruby OData server library based on Sequel and Rack
|
160
177
|
test_files: []
|
data/lib/version.rb
DELETED