grape-swagger-entity 0.3.2 → 0.3.3

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: 728921dd6134e0517a9d041b71ad9eb576cbf69d
4
- data.tar.gz: f5a194a8dfff4a6d26283fdc52dbb75e0530e19a
3
+ metadata.gz: 902654d02c87dd42858477d4696a7696593800b0
4
+ data.tar.gz: 6c26a84436da085cc180e0cbd8fd4e3563d3874b
5
5
  SHA512:
6
- metadata.gz: 6cde2391099a8e9347d51330d750148aa6d197d6aab5e3d369b1a864ebfe397f26aa42ac4ca1e7d388415f6956b250f491dfa480629899b13ed66a8e9e41fa7a
7
- data.tar.gz: 3936253b710cae0bdde531efa60bdc90e3f6c3063c990748c1f4d026cc4f94e9f3c8a0e3e73ed479898a5fbdfaf8bf83c1c5852dfefb0cf1288c2aac7c429394
6
+ metadata.gz: 5e2251aa39d752f7c791c4d7d933fc3844f1be16308ea083a16fc6d86c6dea5b161f3e806fc8a051ffbe31636ce6399d97a664b7175daee5f2b4fa4af09cc09c
7
+ data.tar.gz: 36ff527340980f5368feb9ed2fb057236d316b4b4e3f3a4a90054ea046a596914c42165aa0388cae852205e12f3c7dc83a1276f8bebd0c7c08569a4569f3cdf8
@@ -10,18 +10,19 @@ after_success:
10
10
  - bundle exec danger
11
11
 
12
12
  rvm:
13
- - 2.4.2
14
- - 2.3.5
13
+ - 2.4.5
14
+ - 2.5.3
15
+ - 2.6.0
15
16
 
16
17
  env:
17
- - GRAPE_ENTITY=0.5.2
18
18
  - GRAPE_ENTITY=0.6.1
19
+ - GRAPE_ENTITY=0.7.1
19
20
 
20
21
  matrix:
21
22
  fast_finish: true
22
23
 
23
24
  include:
24
- - rvm: 2.2.8
25
+ - rvm: 2.3.8
25
26
  env:
26
27
  - rvm: ruby-head
27
28
  env:
@@ -31,7 +32,7 @@ matrix:
31
32
  env:
32
33
 
33
34
  allow_failures:
34
- - rvm: 2.2.8
35
+ - rvm: 2.3.8
35
36
  - rvm: ruby-head
36
37
  - rvm: jruby-head
37
38
  - rvm: rbx-2
@@ -8,6 +8,12 @@
8
8
 
9
9
  * Your contribution here.
10
10
 
11
+ ### 0.3.3 (Fabruary 22, 2019)
12
+
13
+ #### Features
14
+
15
+ * [#39](https://github.com/ruby-grape/grape-swagger-entity/pull/39): Fix to avoid conflict with polymorphic model - [@kinoppyd](https://github.com/kinoppyd).
16
+
11
17
  ### 0.3.2 (January 15, 2019)
12
18
 
13
19
  #### Features
@@ -17,6 +17,14 @@ module GrapeSwagger
17
17
 
18
18
  private
19
19
 
20
+ class Alias
21
+ attr_reader :original, :renamed
22
+ def initialize(original, renamed)
23
+ @original = original
24
+ @renamed = renamed
25
+ end
26
+ end
27
+
20
28
  def extract_params(exposure)
21
29
  exposure.root_exposures.each_with_object({}) do |value, memo|
22
30
  if value.for_merge && (value.respond_to?(:entity_class) || value.respond_to?(:using_class_name))
@@ -25,7 +33,8 @@ module GrapeSwagger
25
33
  extracted_params = extract_params(entity_class)
26
34
  memo.merge!(extracted_params)
27
35
  else
28
- memo[value.attribute] = value.send(:options)
36
+ opts = value.send(:options)
37
+ opts[:as] ? memo[Alias.new(value.attribute, opts[:as])] = opts : memo[value.attribute] = opts
29
38
  end
30
39
  end
31
40
  end
@@ -39,6 +48,7 @@ module GrapeSwagger
39
48
  hidden_option = documentation_options.fetch(:hidden, nil)
40
49
  next if in_option == 'header' || hidden_option == true
41
50
 
51
+ entity_name = entity_name.original if entity_name.is_a?(Alias)
42
52
  final_entity_name = entity_options.fetch(:as, entity_name)
43
53
  documentation = entity_options[:documentation]
44
54
 
@@ -1,5 +1,5 @@
1
1
  module GrapeSwagger
2
2
  module Entity
3
- VERSION = '0.3.2'.freeze
3
+ VERSION = '0.3.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-swagger-entity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kirill Zaitsev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-15 00:00:00.000000000 Z
11
+ date: 2019-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape-entity