dynomite 1.2.0 → 1.2.1
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/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/lib/dynomite.rb +1 -0
- data/lib/dynomite/errors.rb +15 -0
- data/lib/dynomite/item.rb +6 -2
- data/lib/dynomite/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86f0dd2d67b74fad780ef023ce7d4dcf40b4ee1741ca57fa730d9c5d3a615a96
|
4
|
+
data.tar.gz: d5f0f59d7761708f8ddb00efdd9bc82d9803234ba6fa4b1dda3486aae9210f60
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b32a45f367418c5d825bf294c1095949b963ea9abc86aafb3a3529c3097789cb723bc7f53940774c492b8512ddaf4e36746e3150520ca6cc796b7046db634a00
|
7
|
+
data.tar.gz: ed3daf9d3667901038c4aa66884e2883d8d7cd6ef675212818b715ba539c834e57bb0832ab02b4fc376ced1a86b68735499638f177e765231b635d2383d371f3
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,14 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.2.1]
|
7
|
+
- #10 from gotchane/fix-readme-about-validation
|
8
|
+
- #8 from patchkit-net/feature/replace-return-self
|
9
|
+
- #9 from patchkit-net/feature/custom-errors
|
10
|
+
- Change Item#replace method to return self
|
11
|
+
- Add custom Dynomite::Errors::ValidationError and Dynomite::Errors::ReservedWordError
|
12
|
+
fixing rspec warnings.
|
13
|
+
|
6
14
|
## [1.2.0]
|
7
15
|
- #7 from patchkit-net/feature/validations
|
8
16
|
- Add a way to quickly define getters and setters using `column` method
|
data/README.md
CHANGED
data/lib/dynomite.rb
CHANGED
data/lib/dynomite/item.rb
CHANGED
@@ -41,6 +41,7 @@ module Dynomite
|
|
41
41
|
class Item
|
42
42
|
include Log
|
43
43
|
include DbConfig
|
44
|
+
include Errors
|
44
45
|
|
45
46
|
def initialize(attrs={})
|
46
47
|
@attrs = attrs
|
@@ -79,12 +80,13 @@ module Dynomite
|
|
79
80
|
attrs = self.class.replace(@attrs)
|
80
81
|
|
81
82
|
@attrs = attrs # refresh attrs because it now has the id
|
83
|
+
self
|
82
84
|
end
|
83
85
|
|
84
86
|
# Similar to replace, but raises an error on failed validation.
|
85
87
|
# Works that way only if ActiveModel::Validations are included
|
86
88
|
def replace!(hash={})
|
87
|
-
raise "Validation failed: #{errors.full_messages.join(', ')}" unless replace(hash)
|
89
|
+
raise ValidationError, "Validation failed: #{errors.full_messages.join(', ')}" unless replace(hash)
|
88
90
|
end
|
89
91
|
|
90
92
|
def find(id)
|
@@ -321,7 +323,9 @@ module Dynomite
|
|
321
323
|
|
322
324
|
# @see Item.column
|
323
325
|
def self.add_column(name)
|
324
|
-
|
326
|
+
if Dynomite::RESERVED_WORDS.include?(name)
|
327
|
+
raise ReservedWordError, "'#{name}' is a reserved word"
|
328
|
+
end
|
325
329
|
|
326
330
|
define_method(name) do
|
327
331
|
@attrs[name.to_s]
|
data/lib/dynomite/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dynomite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- lib/dynomite/core.rb
|
103
103
|
- lib/dynomite/db_config.rb
|
104
104
|
- lib/dynomite/erb.rb
|
105
|
+
- lib/dynomite/errors.rb
|
105
106
|
- lib/dynomite/item.rb
|
106
107
|
- lib/dynomite/log.rb
|
107
108
|
- lib/dynomite/migration.rb
|