vesper-rails 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/vesper/model/types/array_type.rb +25 -0
- data/lib/vesper/model/types/hash_type.rb +27 -0
- data/lib/vesper/version.rb +1 -1
- data/lib/vesper-rails.rb +2 -1
- metadata +3 -2
- data/lib/vesper/types/hash_type.rb +0 -25
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bcbf7aa7d9c21aa8b63d5d952de9f9f1c7a9cdfec40e7199ba651c6569d4ac7c
|
|
4
|
+
data.tar.gz: 6b0a358614b227d3d7c2b80e50922ade4e1af30b06da695af200d898a05fb7c6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 87ddd631d6b44d2d8d400f7b2def0c88e1f9b85812612711974d58ae53057e9a08a91d76e062029fae4be11d089cea9ce0f276d065f5e7698cb076340a04d70d
|
|
7
|
+
data.tar.gz: 2677bef12e6b6ad41fd341da49c24c9a0b851d9a26f2a7c3a9f509c52c62d748d4dc9ecd7c3e2bbca718be642614c9af5a5eaeaa60a8581122903e74b36e34dc
|
data/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Vesper::Model::Types::ArrayType class
|
|
5
|
+
#
|
|
6
|
+
module Vesper
|
|
7
|
+
module Model
|
|
8
|
+
module Types
|
|
9
|
+
class ArrayType < ActiveModel::Type::Value
|
|
10
|
+
def cast(value)
|
|
11
|
+
case value
|
|
12
|
+
when Array then value
|
|
13
|
+
when String then Oj.load(value)
|
|
14
|
+
when NilClass then []
|
|
15
|
+
else Array(value)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def serialize(value)
|
|
20
|
+
JsonUtil.stringify(Array(value))
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Vesper::Model::Types::HashType class
|
|
5
|
+
#
|
|
6
|
+
module Vesper
|
|
7
|
+
module Model
|
|
8
|
+
module Types
|
|
9
|
+
class HashType < ActiveModel::Type::Value
|
|
10
|
+
def cast(value)
|
|
11
|
+
case value
|
|
12
|
+
when Hash then value
|
|
13
|
+
when String then Oj.load(value)
|
|
14
|
+
when NilClass then {}
|
|
15
|
+
else Hash(value)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def serialize(value)
|
|
20
|
+
JsonUtil.stringify(Hash(value))
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
ActiveModel::Type.register(:hash, Vesper::Model::Types::HashType)
|
data/lib/vesper/version.rb
CHANGED
data/lib/vesper-rails.rb
CHANGED
|
@@ -6,7 +6,8 @@ require "vesper/api/unauthorized_error"
|
|
|
6
6
|
|
|
7
7
|
require "vesper/model/errors/a_p_i"
|
|
8
8
|
|
|
9
|
-
require "vesper/types/
|
|
9
|
+
require "vesper/model/types/array_type"
|
|
10
|
+
require "vesper/model/types/hash_type"
|
|
10
11
|
|
|
11
12
|
require "vesper/models/error_map"
|
|
12
13
|
require "vesper/models/error_messages"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vesper-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yasumasa Ashida
|
|
@@ -99,6 +99,8 @@ files:
|
|
|
99
99
|
- lib/vesper/api/unauthorized_error.rb
|
|
100
100
|
- lib/vesper/engine.rb
|
|
101
101
|
- lib/vesper/model/errors/a_p_i.rb
|
|
102
|
+
- lib/vesper/model/types/array_type.rb
|
|
103
|
+
- lib/vesper/model/types/hash_type.rb
|
|
102
104
|
- lib/vesper/models/error_map.rb
|
|
103
105
|
- lib/vesper/models/error_messages.rb
|
|
104
106
|
- lib/vesper/reloadable.rb
|
|
@@ -107,7 +109,6 @@ files:
|
|
|
107
109
|
- lib/vesper/resources/error_messages_resource.rb
|
|
108
110
|
- lib/vesper/stream/error/renderable.rb
|
|
109
111
|
- lib/vesper/stream/renderable.rb
|
|
110
|
-
- lib/vesper/types/hash_type.rb
|
|
111
112
|
- lib/vesper/version.rb
|
|
112
113
|
homepage: https://github.com/asip/vesper-rails
|
|
113
114
|
licenses:
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Vesper::Types::HashType class
|
|
5
|
-
#
|
|
6
|
-
module Vesper
|
|
7
|
-
module Types
|
|
8
|
-
class HashType < ActiveModel::Type::Value
|
|
9
|
-
def cast(value)
|
|
10
|
-
case value
|
|
11
|
-
when Hash then value
|
|
12
|
-
when String then Oj.load(value)
|
|
13
|
-
when NilClass then {}
|
|
14
|
-
else Hash(value)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def serialize(value)
|
|
19
|
-
JsonUtil.stringify(Hash(value))
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
ActiveModel::Type.register(:hash, Vesper::Types::HashType)
|