safrano 0.4.1 → 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/batch.rb +6 -6
- data/lib/odata/collection.rb +134 -74
- data/lib/odata/collection_filter.rb +40 -9
- data/lib/odata/collection_media.rb +53 -54
- data/lib/odata/collection_order.rb +46 -36
- data/lib/odata/common_logger.rb +34 -34
- data/lib/odata/entity.rb +86 -70
- data/lib/odata/error.rb +17 -4
- data/lib/odata/expand.rb +123 -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 +36 -40
- data/lib/odata/select.rb +42 -0
- data/lib/odata/url_parameters.rb +51 -36
- data/lib/safrano.rb +5 -5
- data/lib/safrano/core.rb +10 -1
- data/lib/safrano/multipart.rb +16 -16
- data/lib/safrano/rack_app.rb +3 -3
- data/lib/safrano/request.rb +6 -6
- data/lib/safrano/response.rb +1 -1
- data/lib/safrano/service.rb +64 -119
- data/lib/safrano/version.rb +1 -1
- data/lib/sequel/plugins/join_by_paths.rb +11 -10
- metadata +5 -3
data/lib/safrano/version.rb
CHANGED
@@ -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.
|
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: 2020-
|
11
|
+
date: 2020-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/odata/common_logger.rb
|
124
124
|
- lib/odata/entity.rb
|
125
125
|
- lib/odata/error.rb
|
126
|
+
- lib/odata/expand.rb
|
126
127
|
- lib/odata/filter/error.rb
|
127
128
|
- lib/odata/filter/parse.rb
|
128
129
|
- lib/odata/filter/sequel.rb
|
@@ -130,6 +131,7 @@ files:
|
|
130
131
|
- lib/odata/filter/tree.rb
|
131
132
|
- lib/odata/navigation_attribute.rb
|
132
133
|
- lib/odata/relations.rb
|
134
|
+
- lib/odata/select.rb
|
133
135
|
- lib/odata/url_parameters.rb
|
134
136
|
- lib/odata/walker.rb
|
135
137
|
- lib/safrano.rb
|
@@ -169,5 +171,5 @@ requirements: []
|
|
169
171
|
rubygems_version: 3.1.2
|
170
172
|
signing_key:
|
171
173
|
specification_version: 4
|
172
|
-
summary: Safrano is a Ruby
|
174
|
+
summary: Safrano is a Ruby OData server library based on Sequel and Rack
|
173
175
|
test_files: []
|