safrano 0.4.2 → 0.5.0

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.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/core_ext/Dir/iter.rb +18 -0
  3. data/lib/core_ext/Hash/transform.rb +21 -0
  4. data/lib/core_ext/Integer/edm.rb +13 -0
  5. data/lib/core_ext/REXML/Document/output.rb +16 -0
  6. data/lib/core_ext/String/convert.rb +25 -0
  7. data/lib/core_ext/String/edm.rb +13 -0
  8. data/lib/core_ext/dir.rb +3 -0
  9. data/lib/core_ext/hash.rb +3 -0
  10. data/lib/core_ext/integer.rb +3 -0
  11. data/lib/core_ext/rexml.rb +3 -0
  12. data/lib/core_ext/string.rb +5 -0
  13. data/lib/odata/attribute.rb +15 -10
  14. data/lib/odata/batch.rb +9 -7
  15. data/lib/odata/collection.rb +140 -591
  16. data/lib/odata/collection_filter.rb +18 -42
  17. data/lib/odata/collection_media.rb +111 -54
  18. data/lib/odata/collection_order.rb +5 -2
  19. data/lib/odata/common_logger.rb +2 -0
  20. data/lib/odata/complex_type.rb +152 -0
  21. data/lib/odata/edm/primitive_types.rb +184 -0
  22. data/lib/odata/entity.rb +123 -172
  23. data/lib/odata/error.rb +183 -32
  24. data/lib/odata/expand.rb +20 -17
  25. data/lib/odata/filter/base.rb +74 -0
  26. data/lib/odata/filter/error.rb +49 -6
  27. data/lib/odata/filter/parse.rb +41 -25
  28. data/lib/odata/filter/sequel.rb +133 -62
  29. data/lib/odata/filter/sequel_function_adapter.rb +148 -0
  30. data/lib/odata/filter/token.rb +26 -19
  31. data/lib/odata/filter/tree.rb +106 -52
  32. data/lib/odata/function_import.rb +168 -0
  33. data/lib/odata/model_ext.rb +639 -0
  34. data/lib/odata/navigation_attribute.rb +13 -26
  35. data/lib/odata/relations.rb +5 -5
  36. data/lib/odata/select.rb +17 -5
  37. data/lib/odata/transition.rb +71 -0
  38. data/lib/odata/url_parameters.rb +100 -24
  39. data/lib/odata/walker.rb +20 -10
  40. data/lib/safrano.rb +18 -38
  41. data/lib/safrano/contract.rb +143 -0
  42. data/lib/safrano/core.rb +23 -107
  43. data/lib/safrano/core_ext.rb +13 -0
  44. data/lib/safrano/deprecation.rb +73 -0
  45. data/lib/safrano/multipart.rb +29 -33
  46. data/lib/safrano/rack_app.rb +66 -65
  47. data/lib/safrano/{odata_rack_builder.rb → rack_builder.rb} +18 -2
  48. data/lib/safrano/request.rb +96 -45
  49. data/lib/safrano/response.rb +4 -2
  50. data/lib/safrano/sequel_join_by_paths.rb +2 -2
  51. data/lib/safrano/service.rb +240 -130
  52. data/lib/safrano/version.rb +3 -1
  53. data/lib/sequel/plugins/join_by_paths.rb +6 -19
  54. metadata +32 -11
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Safrano
2
- VERSION = '0.4.2'.freeze
4
+ VERSION = '0.5.0'
3
5
  end
@@ -1,30 +1,14 @@
1
- #!/usr/bin/env ruby
1
+ # frozen_string_literal: true
2
2
 
3
3
  require 'set'
4
4
  require 'sequel'
5
5
 
6
- # some helpers
7
- class String
8
- # thanks https://stackoverflow.com/questions/1448670/ruby-stringto-class
9
- def constantize
10
- names = split('::')
11
- names.shift if names.empty? || names.first.empty?
12
-
13
- const = Object
14
- names.each do |name|
15
- const = if const.const_defined?(name)
16
- const.const_get(name)
17
- else
18
- const.const_missing(name)
19
- end
20
- end
21
- const
22
- end
23
- end
6
+ require 'safrano/core_ext'
24
7
 
25
8
  class PathNode < String
26
9
  attr_accessor :model_class
27
10
  attr_accessor :path_str
11
+
28
12
  def initialize(str, start_model)
29
13
  super(str)
30
14
  @start_model = start_model
@@ -94,6 +78,7 @@ end
94
78
  class JoinByPathsHelper < Set
95
79
  attr_reader :result
96
80
  attr_reader :start_model
81
+
97
82
  EMPTY_ARRAY = [].freeze
98
83
 
99
84
  def initialize(smodel)
@@ -206,6 +191,7 @@ module Sequel
206
191
  module ClassMethods
207
192
  attr_reader :aliases_sym
208
193
  attr_reader :alias_cnt
194
+
209
195
  Plugins.inherited_instance_variables(self,
210
196
  :@aliases_sym => :dup,
211
197
  :@alias_cnt => :dup)
@@ -232,6 +218,7 @@ module Sequel
232
218
 
233
219
  module DatasetMethods
234
220
  attr_reader :join_helper
221
+
235
222
  def join_by_paths(*pathlist)
236
223
  model.join_by_paths_helper(*pathlist).dataset
237
224
  end
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.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
- - D.M.
7
+ - oz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-15 00:00:00.000000000 Z
11
+ date: 2021-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rfc2047
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '0.3'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '0.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,12 +108,23 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.51'
111
- description: Safrano is an OData server library based on Ruby, Rack and Sequel.
111
+ description: Safrano is an OData server library based on Ruby Sequel and Rack.
112
112
  email: dev@aithscel.eu
113
113
  executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
+ - lib/core_ext/Dir/iter.rb
118
+ - lib/core_ext/Hash/transform.rb
119
+ - lib/core_ext/Integer/edm.rb
120
+ - lib/core_ext/REXML/Document/output.rb
121
+ - lib/core_ext/String/convert.rb
122
+ - lib/core_ext/String/edm.rb
123
+ - lib/core_ext/dir.rb
124
+ - lib/core_ext/hash.rb
125
+ - lib/core_ext/integer.rb
126
+ - lib/core_ext/rexml.rb
127
+ - lib/core_ext/string.rb
117
128
  - lib/odata/attribute.rb
118
129
  - lib/odata/batch.rb
119
130
  - lib/odata/collection.rb
@@ -121,24 +132,34 @@ files:
121
132
  - lib/odata/collection_media.rb
122
133
  - lib/odata/collection_order.rb
123
134
  - lib/odata/common_logger.rb
135
+ - lib/odata/complex_type.rb
136
+ - lib/odata/edm/primitive_types.rb
124
137
  - lib/odata/entity.rb
125
138
  - lib/odata/error.rb
126
139
  - lib/odata/expand.rb
140
+ - lib/odata/filter/base.rb
127
141
  - lib/odata/filter/error.rb
128
142
  - lib/odata/filter/parse.rb
129
143
  - lib/odata/filter/sequel.rb
144
+ - lib/odata/filter/sequel_function_adapter.rb
130
145
  - lib/odata/filter/token.rb
131
146
  - lib/odata/filter/tree.rb
147
+ - lib/odata/function_import.rb
148
+ - lib/odata/model_ext.rb
132
149
  - lib/odata/navigation_attribute.rb
133
150
  - lib/odata/relations.rb
134
151
  - lib/odata/select.rb
152
+ - lib/odata/transition.rb
135
153
  - lib/odata/url_parameters.rb
136
154
  - lib/odata/walker.rb
137
155
  - lib/safrano.rb
156
+ - lib/safrano/contract.rb
138
157
  - lib/safrano/core.rb
158
+ - lib/safrano/core_ext.rb
159
+ - lib/safrano/deprecation.rb
139
160
  - lib/safrano/multipart.rb
140
- - lib/safrano/odata_rack_builder.rb
141
161
  - lib/safrano/rack_app.rb
162
+ - lib/safrano/rack_builder.rb
142
163
  - lib/safrano/request.rb
143
164
  - lib/safrano/response.rb
144
165
  - lib/safrano/sequel_join_by_paths.rb
@@ -168,8 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
189
  - !ruby/object:Gem::Version
169
190
  version: '0'
170
191
  requirements: []
171
- rubygems_version: 3.1.2
192
+ rubygems_version: 3.2.5
172
193
  signing_key:
173
194
  specification_version: 4
174
- summary: Safrano is a Ruby OData server library based on Sequel and Rack
195
+ summary: Safrano is an OData server library based on Ruby Sequel and Rack
175
196
  test_files: []