conglomerate 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/conglomerate/serializer.rb +12 -0
- data/lib/conglomerate/version.rb +1 -1
- data/spec/conglomerate_spec.rb +9 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ecec2dd728808b6548bbd891a90a1ae6939afa1
|
4
|
+
data.tar.gz: a109f0656695f3abbfa1d99e4c71055cfc434c59
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e2f0834e369486e5d9e8d16d99d3d9683736b62a195713155b5dde44101ef0375ae59405d81cec6562f1ce3a39cc6fb108e239912a2b37a75ced1b76dafeae6
|
7
|
+
data.tar.gz: 466427fff930ebd97cbe510116ba80ad5075be0d15b2387c21e69475e0455b21bf26fcd6201c605533e705f6c7386d92c532e78d860edc4237fbff3e90c01a7e
|
@@ -52,6 +52,7 @@ module Conglomerate
|
|
52
52
|
value = sanitize_value(
|
53
53
|
object, :name => name, :type => type, :default_value => default_value
|
54
54
|
)
|
55
|
+
value = format_value(value)
|
55
56
|
|
56
57
|
{"name" => name.to_s, type.to_s => value}.tap do |d|
|
57
58
|
d["prompt"] = prompt if build_template && prompt
|
@@ -188,6 +189,17 @@ module Conglomerate
|
|
188
189
|
end
|
189
190
|
end
|
190
191
|
|
192
|
+
def format_value(value)
|
193
|
+
case value
|
194
|
+
when DateTime, Time
|
195
|
+
value.iso8601.sub(/\+00:00$/, "Z")
|
196
|
+
when Date
|
197
|
+
value.strftime("%Y-%m-%d")
|
198
|
+
else
|
199
|
+
value
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
191
203
|
def blank?(value)
|
192
204
|
if value.is_a?(String)
|
193
205
|
value !~ /[^[:space:]]/
|
data/lib/conglomerate/version.rb
CHANGED
data/spec/conglomerate_spec.rb
CHANGED
@@ -18,6 +18,9 @@ class ConglomerateTestSerializer
|
|
18
18
|
attribute :team_ids, :rel => :teams, :type => :array do |item|
|
19
19
|
team_url(item.team_ids.join(","))
|
20
20
|
end
|
21
|
+
attribute :event_date_time
|
22
|
+
attribute :event_date
|
23
|
+
attribute :event_time
|
21
24
|
item_link :users do |item|
|
22
25
|
users_search_url :object_id => item.id
|
23
26
|
end
|
@@ -50,6 +53,9 @@ describe Conglomerate do
|
|
50
53
|
"Object",
|
51
54
|
:id => 1,
|
52
55
|
:description => "Tasty Burgers",
|
56
|
+
:event_date_time => DateTime.parse("1981-11-28T10:00:00+00:00"),
|
57
|
+
:event_date => Date.parse("1981-11-28"),
|
58
|
+
:event_time => Time.parse("1981-11-28T10:00:00+00:00"),
|
53
59
|
:event_id => 2,
|
54
60
|
:roster_id => nil,
|
55
61
|
:team_ids => [1,2],
|
@@ -164,6 +170,9 @@ describe Conglomerate do
|
|
164
170
|
{"name" => "event_id", "value" => 2},
|
165
171
|
{"name" => "roster_id", "value" => nil},
|
166
172
|
{"name" => "team_ids", "array" => [1,2]},
|
173
|
+
{"name" => "event_date_time", "value" => "1981-11-28T10:00:00Z"},
|
174
|
+
{"name" => "event_date", "value" => "1981-11-28"},
|
175
|
+
{"name" => "event_time", "value" => "1981-11-28T10:00:00Z"},
|
167
176
|
{"name" => "is_available", "value" => false}
|
168
177
|
],
|
169
178
|
"links" => [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: conglomerate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Emmons
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,11 +90,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
90
|
version: '0'
|
91
91
|
requirements: []
|
92
92
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.2.
|
93
|
+
rubygems_version: 2.2.2
|
94
94
|
signing_key:
|
95
95
|
specification_version: 4
|
96
96
|
summary: A library to serialize Ruby objects into collection+json
|
97
97
|
test_files:
|
98
98
|
- spec/conglomerate_spec.rb
|
99
99
|
- spec/spec_helper.rb
|
100
|
-
has_rdoc:
|