apicasso 0.6.6 → 0.6.7

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
  SHA256:
3
- metadata.gz: 05272b515597bae8632763fc837cc5e18ac0ed42209068b4f88d19b6c7356043
4
- data.tar.gz: 4e31ec9f33f2d7f1fe91c5154c80992390af1b65dc50e90b7e68f2ed2986472d
3
+ metadata.gz: 13242e2ac1896a4ae9d05c041ee23b8bc954aaf90732b7ca20d1896841f9f7bb
4
+ data.tar.gz: 24b133086210106ae44cbc466005b3751824917af2539a66abc849c2e885cf9b
5
5
  SHA512:
6
- metadata.gz: 7f249d297a5ab7abc073f4419acae6f99b7e03859f2afbd170079f9d3832d634ae87b51891939fab83dc6b2fb600e2d01e07a888c645b5e9e3ce59a005980c5e
7
- data.tar.gz: d33c492ef94b5184acb47b30f621d7fe5bc355868f6c08ae6fcf7bf8a59e81e55ac66c5104a005902e8c3f6c83ccccef8f94f1dc51ffeb3914bdac5663ed2da1
6
+ metadata.gz: 3cbf859e001818cfad717b2e1331d946a52f8bcbcebd710a1edf04f2a00ef3defbd9d01977e8ae096dd7ed95829005920bd8481c56f6ee3115d059caa01f3fcc
7
+ data.tar.gz: a603985b883293f34cbfff86960b7101ac29b3bb686d34e2e851125ef58c83accbec278a2b51dcf19126616a354828b5e356e21a1848ab1dda016ab5ad9b98cd
@@ -355,11 +355,18 @@ module Apicasso
355
355
  end
356
356
 
357
357
  # Resource's associations definitions
358
- model.reflect_on_all_associations.map(&:name).each do |association|
359
- inner_name = association.to_s.classify
358
+ model.reflect_on_all_associations.each do |association|
359
+ begin
360
+ inner_name = association.class_name.to_s.classify
361
+ rescue NoMethodError, ActionController::RoutingError
362
+ inner_name = association.name.to_s.classify
363
+ end
364
+
365
+ next if Apicasso.configuration.model_definitions_excluded.include?(inner_name)
366
+ next if association.polymorphic?
360
367
  next if ASSOCIATION_EXCLUDED.include?(inner_name)
361
368
  inner_klass = begin inner_name.constantize rescue NameError; false end
362
- swagger_path "/#{model.name.underscore}/{id}/#{association}" do
369
+ swagger_path "/#{model.name.underscore}/{id}/#{association.name}" do
363
370
  operation :get do
364
371
  key :summary, I18n.t("activerecord.models.#{inner_name.underscore}.index.summary", default: inner_name)
365
372
  key :description, I18n.t("activerecord.models.#{inner_name.underscore}.index.description", default: inner_name)
@@ -2,7 +2,7 @@ module Apicasso
2
2
  # This class exposes the settable attributes of the gem
3
3
  class Configuration
4
4
  attr_accessor :origins, :headers, :resource, :credentials, :methods,
5
- :max_age, :expose, :if, :vary
5
+ :max_age, :expose, :if, :vary, :model_definitions_excluded
6
6
 
7
7
  def initialize
8
8
  @origins = nil
@@ -14,6 +14,7 @@ module Apicasso
14
14
  @expose = nil
15
15
  @if = nil
16
16
  @vary = nil
17
+ @model_definitions_excluded = []
17
18
  end
18
19
  end
19
20
  end
@@ -3,5 +3,5 @@
3
3
  # A Module to rule them all...
4
4
  module Apicasso
5
5
  # Current gem version
6
- VERSION = '0.6.6'.freeze
6
+ VERSION = '0.6.7'.freeze
7
7
  end
@@ -50,4 +50,8 @@ Apicasso.configure do |config|
50
50
  # a valid CORS request.
51
51
  # Must be a Proc
52
52
  config.if = nil
53
+
54
+ # Associations to be excluded in definitions when generate the
55
+ # documentation by APIcasso.
56
+ config.model_definitions_excluded = []
53
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apicasso
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Bellincanta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-03 00:00:00.000000000 Z
11
+ date: 2018-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler