restpack_serializer 0.5.1 → 0.5.2

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
  SHA1:
3
- metadata.gz: 8306de0e143806588fef98d814a5192f60f65ae0
4
- data.tar.gz: c398f21e59a7f5b05132a3f9b7910d58373493e1
3
+ metadata.gz: 6e057f9443e4458620f07fe24d2c231caac2aab7
4
+ data.tar.gz: e84c048d7a562944581eaec14e353147df4b0398
5
5
  SHA512:
6
- metadata.gz: 226bf5411139df7703abb7c32d90e9d07f6537b823bdb18792ea38cd449b80d6c29e5ffd11bed89e1939241211a63d8ab6244e310d469e031e1b75385dc7a7a7
7
- data.tar.gz: 327070d269ca743f15d2217cce4e3a9c5b013ae39bf8a3e13eb0f2f9eff398bc142cdc62e8c405a615b92fb1b714a87ab313f97b03c5f57cdb197a23a3cdfae2
6
+ metadata.gz: cc7334b9da94b802974a40351c7be43860d5691129cdd1d8f84aa56c3e7ea68ba83ce454144c192bd64d439f9fb36e32551361f852ef512d80d260d51ee04f9f
7
+ data.tar.gz: e08a930f72863feffacea046f8e5fbaacf6a941416f2302a68eef87ba0b7bbe99397fbff40f3d916e46fd2541d8ad21d1e74e1ed4355cfa49f22710c0a6fc492
data/README.md CHANGED
@@ -57,7 +57,7 @@ end
57
57
  }
58
58
  ```
59
59
 
60
- `as_json` accepts an optional `context` hash parameter which can be used be your Serializers to customize their output:
60
+ `as_json` accepts an optional `context` hash parameter which can be used by your Serializers to customize their output:
61
61
 
62
62
  ```ruby
63
63
  class AlbumSerializer
@@ -71,7 +71,7 @@ module RestPack
71
71
  if foreign_key_value
72
72
  data[:links][association.name.to_sym] = foreign_key_value.to_s
73
73
  end
74
- elsif association.macro == :has_many && association.options[:through]
74
+ elsif association.macro == :has_many
75
75
  ids = model.send(association.name).pluck(:id).map { |id| id.to_s }
76
76
 
77
77
  data[:links] ||= {}
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Serializer
3
- VERSION = '0.5.1'
3
+ VERSION = '0.5.2'
4
4
  end
5
5
  end
@@ -133,7 +133,7 @@ describe RestPack::Serializer::Paging do
133
133
  album_model = MyApp::Album.find(album[:id])
134
134
 
135
135
  album[:links][:artist].should == album_model.artist_id.to_s
136
- album[:links][:songs].should == page[:songs].map { |song| song[:id] }
136
+ (page[:songs].map { |song| song[:id] } - album[:links][:songs]).empty?.should be_truthy
137
137
  end
138
138
 
139
139
  context "with includes as comma delimited string" do
@@ -159,9 +159,7 @@ describe RestPack::Serializer do
159
159
  artist_with_fans = FactoryGirl.create :artist_with_fans
160
160
 
161
161
  json = artist_serializer.as_json(artist_with_fans)
162
- json[:links].should == {
163
- fans: artist_with_fans.fans.collect {|obj| obj.id.to_s }
164
- }
162
+ json[:links][:fans].should == artist_with_fans.fans.collect {|obj| obj.id.to_s }
165
163
  end
166
164
  end
167
165
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-10 00:00:00.000000000 Z
11
+ date: 2014-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport