as_json_representations 0.5.1 → 0.6.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: ce80219b86473f50512faf0d626b53d41bd8794213eb7aa67c02c73efe0290eb
4
- data.tar.gz: 4e79d1d3110b77827d58dbf2510f61d6bd753775cbfd9003da4128d3f017f16f
3
+ metadata.gz: a2411f12b165485b579cf9650b2ee1de6d197daa4fdbea9ecd952b31b0c68a8f
4
+ data.tar.gz: 3c4e24fb9e8d229ee9177e605535cc8ab2bdd6a968b15d1e611f1abea1965821
5
5
  SHA512:
6
- metadata.gz: 8f452787f29312c9db468b01fb4c13fb6ab364e310909a6f67f817a931db71df6127d2afb2898b4aa3d89f35629b1669647c1862b08789f56846c80fe4173c3a
7
- data.tar.gz: ac493e121af24b81ace1f44487a3abd7c5ce75018e050858ebdbfde70c160e3905138b16acf30592a47288c182fe703156eee1b62dea0b87474b75950608de2f
6
+ metadata.gz: ab50b7d16894eb166c95a833d433b8138380b9f5eb51ff01719d61a32b550e623e1801bcb413abee8e3c63accfeabc2fe616316199e9989b7c027b91f6cf4543
7
+ data.tar.gz: 294d76aaeb638dbe1fa55c04c89300a0c376c4af9739d19d72c7bd450562f08fac89efb85e7c798eeb773fae0a68dbefe70feb6b159fa94a42ba9fa8e3b9cb50
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- as_json_representations (0.5.1)
4
+ as_json_representations (0.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  byebug (11.0.1)
10
10
  diff-lcs (1.3)
11
- rake (10.5.0)
11
+ rake (13.0.1)
12
12
  rspec (3.7.0)
13
13
  rspec-core (~> 3.7.0)
14
14
  rspec-expectations (~> 3.7.0)
@@ -30,8 +30,8 @@ DEPENDENCIES
30
30
  as_json_representations!
31
31
  bundler (~> 1.15)
32
32
  byebug
33
- rake (~> 10.0)
33
+ rake (~> 13.0)
34
34
  rspec (~> 3.0)
35
35
 
36
36
  BUNDLED WITH
37
- 1.17.2
37
+ 1.17.3
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ['lib']
23
23
 
24
24
  spec.add_development_dependency 'bundler', '~> 1.15'
25
- spec.add_development_dependency 'rake', '~> 10.0'
25
+ spec.add_development_dependency 'rake', '~> 13.0'
26
26
  spec.add_development_dependency 'rspec', '~> 3.0'
27
27
  end
@@ -1,6 +1,8 @@
1
1
  require 'as_json_representations/collection.rb'
2
2
 
3
3
  module AsJsonRepresentations
4
+ QUERY_METHODS = %i[includes eager_load preload].freeze
5
+
4
6
  module ClassMethods
5
7
  def representation(name, options={}, &block)
6
8
  @representations ||= {}
@@ -11,7 +13,7 @@ module AsJsonRepresentations
11
13
  extend_representation_name = options[:extend] == true ? name : options[:extend]
12
14
  extend_representation = (parent_entity || self).representations[extend_representation_name]
13
15
 
14
- %i[includes eager_load].each do |option|
16
+ QUERY_METHODS.each do |option|
15
17
  next unless (extend_option_value = extend_representation[option])
16
18
  @representations[name][option] = extend_option_value + (options[option] || [])
17
19
  end
@@ -11,7 +11,7 @@ module AsJsonRepresentations
11
11
 
12
12
  if respond_to?(:klass) && klass.respond_to?(:representations)
13
13
  # call supported methods of ActiveRecord::QueryMethods
14
- %i[includes eager_load].each do |method|
14
+ QUERY_METHODS.each do |method|
15
15
  next unless respond_to? method
16
16
 
17
17
  args = klass.representations.dig(options[:representation], method)
@@ -1,3 +1,3 @@
1
1
  module AsJsonRepresentations
2
- VERSION = '0.5.1'
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: as_json_representations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rjurado01
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-01-10 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '10.0'
33
+ version: '13.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '10.0'
40
+ version: '13.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -92,8 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
94
  requirements: []
95
- rubyforge_project:
96
- rubygems_version: 2.7.3
95
+ rubygems_version: 3.1.2
97
96
  signing_key:
98
97
  specification_version: 4
99
98
  summary: Creates representations of your model data