attributor 5.1.0 → 5.5
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/.travis.yml +4 -3
- data/CHANGELOG.md +145 -135
- data/attributor.gemspec +5 -6
- data/lib/attributor.rb +17 -2
- data/lib/attributor/attribute.rb +39 -9
- data/lib/attributor/dsl_compiler.rb +17 -9
- data/lib/attributor/exceptions.rb +5 -0
- data/lib/attributor/extras/field_selector.rb +4 -0
- data/lib/attributor/families/numeric.rb +19 -6
- data/lib/attributor/families/temporal.rb +16 -9
- data/lib/attributor/hash_dsl_compiler.rb +6 -6
- data/lib/attributor/smart_attribute_selector.rb +149 -0
- data/lib/attributor/type.rb +27 -4
- data/lib/attributor/types/bigdecimal.rb +7 -2
- data/lib/attributor/types/boolean.rb +7 -2
- data/lib/attributor/types/class.rb +2 -2
- data/lib/attributor/types/collection.rb +22 -5
- data/lib/attributor/types/container.rb +3 -3
- data/lib/attributor/types/csv.rb +5 -1
- data/lib/attributor/types/date.rb +9 -3
- data/lib/attributor/types/date_time.rb +8 -2
- data/lib/attributor/types/float.rb +4 -3
- data/lib/attributor/types/hash.rb +105 -21
- data/lib/attributor/types/integer.rb +7 -1
- data/lib/attributor/types/model.rb +2 -2
- data/lib/attributor/types/object.rb +5 -0
- data/lib/attributor/types/polymorphic.rb +3 -2
- data/lib/attributor/types/string.rb +20 -1
- data/lib/attributor/types/struct.rb +1 -1
- data/lib/attributor/types/symbol.rb +5 -0
- data/lib/attributor/types/tempfile.rb +4 -0
- data/lib/attributor/types/time.rb +7 -3
- data/lib/attributor/types/uri.rb +9 -1
- data/lib/attributor/version.rb +1 -1
- data/spec/attribute_spec.rb +42 -7
- data/spec/dsl_compiler_spec.rb +16 -6
- data/spec/extras/field_selector/field_selector_spec.rb +9 -0
- data/spec/hash_dsl_compiler_spec.rb +2 -2
- data/spec/smart_attribute_selector_spec.rb +272 -0
- data/spec/support/integers.rb +7 -0
- data/spec/type_spec.rb +1 -1
- data/spec/types/bigdecimal_spec.rb +8 -0
- data/spec/types/boolean_spec.rb +10 -0
- data/spec/types/class_spec.rb +0 -1
- data/spec/types/collection_spec.rb +16 -0
- data/spec/types/date_spec.rb +9 -0
- data/spec/types/date_time_spec.rb +9 -0
- data/spec/types/float_spec.rb +8 -0
- data/spec/types/hash_spec.rb +181 -9
- data/spec/types/integer_spec.rb +10 -1
- data/spec/types/model_spec.rb +14 -3
- data/spec/types/string_spec.rb +10 -0
- data/spec/types/temporal_spec.rb +5 -1
- data/spec/types/time_spec.rb +9 -0
- data/spec/types/uri_spec.rb +9 -0
- metadata +24 -34
data/spec/types/temporal_spec.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Attributor::Temporal do
|
4
|
-
subject(:type)
|
4
|
+
subject(:type) do
|
5
|
+
Class.new do
|
6
|
+
include Attributor::Temporal
|
7
|
+
end
|
8
|
+
end
|
5
9
|
|
6
10
|
it 'raises an exception for native_type' do
|
7
11
|
expect { type.native_type }.to raise_error(NotImplementedError)
|
data/spec/types/time_spec.rb
CHANGED
@@ -90,4 +90,13 @@ describe Attributor::Time do
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
93
|
+
context '.as_json_schema' do
|
94
|
+
subject(:js){ type.as_json_schema }
|
95
|
+
it 'adds the right attributes' do
|
96
|
+
expect(js.keys).to include(:type, :'x-type_name')
|
97
|
+
expect(js[:type]).to eq(:string)
|
98
|
+
expect(js[:format]).to eq(:'time')
|
99
|
+
expect(js[:'x-type_name']).to eq('Time')
|
100
|
+
end
|
101
|
+
end
|
93
102
|
end
|
data/spec/types/uri_spec.rb
CHANGED
@@ -109,4 +109,13 @@ describe Attributor::URI do
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|
112
|
+
context '.as_json_schema' do
|
113
|
+
subject(:js){ type.as_json_schema }
|
114
|
+
it 'adds the right attributes' do
|
115
|
+
expect(js.keys).to include(:type, :'x-type_name')
|
116
|
+
expect(js[:type]).to eq(:string)
|
117
|
+
expect(js[:format]).to eq(:uri)
|
118
|
+
expect(js[:'x-type_name']).to eq('URI')
|
119
|
+
end
|
120
|
+
end
|
112
121
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attributor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: '5.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep M. Blanquer
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-08-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hashie
|
@@ -85,44 +85,30 @@ dependencies:
|
|
85
85
|
name: rspec-collection_matchers
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - ">="
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: '
|
90
|
+
version: '0'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: '
|
97
|
+
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
99
|
name: yard
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - "
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: 0.8.7
|
105
|
-
type: :development
|
106
|
-
prerelease: false
|
107
|
-
version_requirements: !ruby/object:Gem::Requirement
|
108
|
-
requirements:
|
109
|
-
- - "~>"
|
110
|
-
- !ruby/object:Gem::Version
|
111
|
-
version: 0.8.7
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: backports
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - "~>"
|
102
|
+
- - ">="
|
117
103
|
- !ruby/object:Gem::Version
|
118
|
-
version: '
|
104
|
+
version: '0'
|
119
105
|
type: :development
|
120
106
|
prerelease: false
|
121
107
|
version_requirements: !ruby/object:Gem::Requirement
|
122
108
|
requirements:
|
123
|
-
- - "
|
109
|
+
- - ">="
|
124
110
|
- !ruby/object:Gem::Version
|
125
|
-
version: '
|
111
|
+
version: '0'
|
126
112
|
- !ruby/object:Gem::Dependency
|
127
113
|
name: yardstick
|
128
114
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,42 +197,42 @@ dependencies:
|
|
211
197
|
name: pry
|
212
198
|
requirement: !ruby/object:Gem::Requirement
|
213
199
|
requirements:
|
214
|
-
- - "
|
200
|
+
- - ">="
|
215
201
|
- !ruby/object:Gem::Version
|
216
202
|
version: '0'
|
217
203
|
type: :development
|
218
204
|
prerelease: false
|
219
205
|
version_requirements: !ruby/object:Gem::Requirement
|
220
206
|
requirements:
|
221
|
-
- - "
|
207
|
+
- - ">="
|
222
208
|
- !ruby/object:Gem::Version
|
223
209
|
version: '0'
|
224
210
|
- !ruby/object:Gem::Dependency
|
225
211
|
name: pry-byebug
|
226
212
|
requirement: !ruby/object:Gem::Requirement
|
227
213
|
requirements:
|
228
|
-
- - "
|
214
|
+
- - ">="
|
229
215
|
- !ruby/object:Gem::Version
|
230
|
-
version: '
|
216
|
+
version: '0'
|
231
217
|
type: :development
|
232
218
|
prerelease: false
|
233
219
|
version_requirements: !ruby/object:Gem::Requirement
|
234
220
|
requirements:
|
235
|
-
- - "
|
221
|
+
- - ">="
|
236
222
|
- !ruby/object:Gem::Version
|
237
|
-
version: '
|
223
|
+
version: '0'
|
238
224
|
- !ruby/object:Gem::Dependency
|
239
225
|
name: pry-stack_explorer
|
240
226
|
requirement: !ruby/object:Gem::Requirement
|
241
227
|
requirements:
|
242
|
-
- - "
|
228
|
+
- - ">="
|
243
229
|
- !ruby/object:Gem::Version
|
244
230
|
version: '0'
|
245
231
|
type: :development
|
246
232
|
prerelease: false
|
247
233
|
version_requirements: !ruby/object:Gem::Requirement
|
248
234
|
requirements:
|
249
|
-
- - "
|
235
|
+
- - ">="
|
250
236
|
- !ruby/object:Gem::Version
|
251
237
|
version: '0'
|
252
238
|
- !ruby/object:Gem::Dependency
|
@@ -338,6 +324,7 @@ files:
|
|
338
324
|
- lib/attributor/families/numeric.rb
|
339
325
|
- lib/attributor/families/temporal.rb
|
340
326
|
- lib/attributor/hash_dsl_compiler.rb
|
327
|
+
- lib/attributor/smart_attribute_selector.rb
|
341
328
|
- lib/attributor/type.rb
|
342
329
|
- lib/attributor/types/bigdecimal.rb
|
343
330
|
- lib/attributor/types/boolean.rb
|
@@ -371,8 +358,10 @@ files:
|
|
371
358
|
- spec/extras/field_selector/field_selector_spec.rb
|
372
359
|
- spec/families_spec.rb
|
373
360
|
- spec/hash_dsl_compiler_spec.rb
|
361
|
+
- spec/smart_attribute_selector_spec.rb
|
374
362
|
- spec/spec_helper.rb
|
375
363
|
- spec/support/hashes.rb
|
364
|
+
- spec/support/integers.rb
|
376
365
|
- spec/support/models.rb
|
377
366
|
- spec/support/polymorphics.rb
|
378
367
|
- spec/type_spec.rb
|
@@ -419,7 +408,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
419
408
|
version: '0'
|
420
409
|
requirements: []
|
421
410
|
rubyforge_project:
|
422
|
-
rubygems_version: 2.
|
411
|
+
rubygems_version: 2.6.14
|
423
412
|
signing_key:
|
424
413
|
specification_version: 4
|
425
414
|
summary: A powerful attribute and type management library for Ruby
|
@@ -432,8 +421,10 @@ test_files:
|
|
432
421
|
- spec/extras/field_selector/field_selector_spec.rb
|
433
422
|
- spec/families_spec.rb
|
434
423
|
- spec/hash_dsl_compiler_spec.rb
|
424
|
+
- spec/smart_attribute_selector_spec.rb
|
435
425
|
- spec/spec_helper.rb
|
436
426
|
- spec/support/hashes.rb
|
427
|
+
- spec/support/integers.rb
|
437
428
|
- spec/support/models.rb
|
438
429
|
- spec/support/polymorphics.rb
|
439
430
|
- spec/type_spec.rb
|
@@ -460,4 +451,3 @@ test_files:
|
|
460
451
|
- spec/types/time_spec.rb
|
461
452
|
- spec/types/type_spec.rb
|
462
453
|
- spec/types/uri_spec.rb
|
463
|
-
has_rdoc:
|