burgundy 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b33ddf407012b8721c8c5c26266a676fe714a54adf4591587745c3aecd5fa2b
4
- data.tar.gz: ebf9996be106b868511e5ed13ca78bc37c1d8442f72bd7a0b94cd7e3c09184fd
3
+ metadata.gz: 0135de677253ae6ac1eb432a531a2ad03d9ea7e01d2f5cfecff1af7b3c86a262
4
+ data.tar.gz: 6d3aef1c8210b1ddcd9f3e4ad48c0531145fa71d7b4b7b8948e51a6b3fa6fd4f
5
5
  SHA512:
6
- metadata.gz: 6c12a95c9d67b134241b436e5014b4fc87c8a5e7a43a537049df0ac38dab5389c36254c6b76728c227708c2dcc2cbf8efa72c80b10e699336d652a1b727ffb8e
7
- data.tar.gz: 329a4ebf4eb90f7ed15dd50675a33546ca26f426f667c5810e32bc4f050d72b2dc2a51aa23f0dffe4bdb216c170cbac0069375e1d24cf285a67d5894e2fb7627
6
+ metadata.gz: 990a2fd0d9501979d3d02149d548885ddf37933258fd671f59b98bef918ab6043e359bebb263657c6076cd757fcf7e186641a4f4d48c6d3ec5463a31561ba240
7
+ data.tar.gz: b7b93b21c5b354ca7f9bc6befae0b5e8701c1aa997df31fd2f2317d3114aadfb009e809920bb7dd1b8ae1c58496ec6ce12b97ff40a684540fdebb68bf97acbf2
@@ -1,3 +1,7 @@
1
+ ## [0.5.0] - 2019-12-10
2
+
3
+ - Add `Burgundy::Item#to_json(*)`.
4
+
1
5
  ## [0.4.0] - 2019-12-10
2
6
 
3
7
  - Add `Burgundy::Item#as_json(*)`, which returns `Burgundy::Item#attributes`.
@@ -44,6 +44,10 @@ module Burgundy
44
44
  attributes
45
45
  end
46
46
 
47
+ def to_json(*)
48
+ as_json.to_json
49
+ end
50
+
47
51
  alias to_hash attributes
48
52
  alias to_h attributes
49
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Burgundy
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
@@ -189,6 +189,21 @@ class BurgundyTest < Minitest::Test
189
189
  assert_equal item.as_json(:name), item.attributes
190
190
  end
191
191
 
192
+ test "implements to_json protocol" do
193
+ wrapper = Class.new(Burgundy::Item) do
194
+ attributes :name
195
+ end
196
+
197
+ object = OpenStruct.new(
198
+ name: "John Doe",
199
+ email: "john@example.com",
200
+ username: "johndoe"
201
+ )
202
+ item = wrapper.new(object)
203
+
204
+ assert_equal %[{"name":"John Doe"}], item.to_json
205
+ end
206
+
192
207
  test "inherits attributes" do
193
208
  parent_wrapper = Class.new(Burgundy::Item) do
194
209
  attributes :name, :username
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burgundy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira