grape_json_api_streamer 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe3493466f27fb633787b38a02da44a71b8f6cea
4
- data.tar.gz: cb0189fe8c1d07822a80b22d4447975fb7a019c2
3
+ metadata.gz: e80c58c6897119112612ba37161cda6445fa0b4a
4
+ data.tar.gz: ee78ff0cef3bba5beeed0d5dac233a2e77617886
5
5
  SHA512:
6
- metadata.gz: 89af7c723843b89c450bd131185600297d40844dbc5ca22cbd45dc4fd52a71a54a909d3135cb39a2ce8b19cb459bdc9751bf496af8de7b646af8071580641a40
7
- data.tar.gz: 87d9149cd45fbc41785652559e8ad906e633cbd08b6634c993b0057745b4f8228fceda18c224711bd821d61af720a53b15eae3f526e3549db5e9f91c4a438af2
6
+ metadata.gz: 12cfdc2b71d666d9fceb7e7f7f7efff4e693142b9533b4431e07585bc540e2e124d9ae701f09e32f1014aa986a51afa3b94596fb27654e235e8f402f67aa8a96
7
+ data.tar.gz: aa21cbbfe37d8cf97d1a6c8b917fe51418fba22cdbc39d81d643b9250806539e41f15c8e8fa3d6cd7ead7f93e6d358386d64ef0024ecd078f5227cbd097a1b90
@@ -6,11 +6,13 @@ module Grape
6
6
  def initialize(collection, options = {})
7
7
  @collection = collection
8
8
  @options = ActiveSupport::HashWithIndifferentAccess.new(options)
9
+ @meta = @options[:meta]
10
+ @links = @options[:links]
9
11
  end
10
12
 
11
13
  def each
12
14
  yield '{'
13
- yield "\"meta\": #{JSON.unparse(@options[:meta])}," if @options[:meta]
15
+ yield "\"meta\": #{JSON.unparse(@meta)}," if @meta
14
16
  yield '"data":['
15
17
  first = true
16
18
  @collection.lazy.each do |object|
@@ -22,12 +24,15 @@ module Grape
22
24
  yield buffer
23
25
  end
24
26
  yield ']'
25
- yield ",\"links\": #{JSON.unparse(@options[:links])}" if @options[:links]
27
+ yield ",\"links\": #{JSON.unparse(@links)}" if @links
26
28
  yield '}'
27
29
  end
28
30
 
29
31
  def serialize(model)
30
- ::JSONAPI::Serializer.serialize(model, is_collection: false)
32
+ @options.delete(:meta)
33
+ @options.delete(:links)
34
+ @options[:is_collection] = false
35
+ ::JSONAPI::Serializer.serialize(model, @options)
31
36
  end
32
37
  end
33
38
  end
@@ -1,7 +1,7 @@
1
1
  module Grape
2
2
  module JSONAPI
3
3
  class Streamer
4
- VERSION = '0.0.5'
4
+ VERSION = '0.0.6'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape_json_api_streamer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Roy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-08 00:00:00.000000000 Z
11
+ date: 2016-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape