pack_api 1.0.4 → 1.0.5

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: 91807c3325db138316580a060e86626a03f7ebc9a4025d673a8144d9faf768e8
4
- data.tar.gz: 22f935038e02720fd46351e96d7c379f40b25c4c930594e3f848b1440769cf8b
3
+ metadata.gz: ac4e447544be25898609198e72112c0da8840ff64e9efdb143d463eec2a34c80
4
+ data.tar.gz: 7576d9e011b764ca396623d7faec591b962c7d3bd407d2f360351e37bdd5efaa
5
5
  SHA512:
6
- metadata.gz: 9c268b476a6c26f6832cb365ac01084309d4644f75a82cccde62223b70a19feda093971266bf620d20d97744e5e28ead4a9e72a778182c55c86b51dfb77f41d1
7
- data.tar.gz: 8d4376d38175ed100ed4aee1ed432f6812ecca77da984e202a91b7dd465d85c5f7bdcd5156830a9ce5510cf45417cab006aa3f84a6685a16ee472f413ada94f5
6
+ metadata.gz: 6c17deb6c83f2e79c9d16ed89caec0aa4baa11476285444956ed653a98badb778283636c3d2361c01b3587e0b9d573b7f5e805e019f05243457cd44420c90df0
7
+ data.tar.gz: b23f8c03c9f2c3bf122102222e0a9380f4870679fa0b335ae8fcb2e8485cad5d6768f4b74120c6e8811e0222c131d868532db57c230ed75e6e8ed1903ec10750
@@ -68,6 +68,10 @@ module PackAPI::Mapping
68
68
  collection_associations.include?(model_attribute)
69
69
  end
70
70
 
71
+ def accepts_nested_attributes_for?(association_name)
72
+ model_type.nested_attributes_options.key?(association_name)
73
+ end
74
+
71
75
  def resource_associations
72
76
  @resource_associations ||= model_type.reflect_on_all_associations
73
77
  .reject(&:collection?)
@@ -81,7 +85,9 @@ module PackAPI::Mapping
81
85
  end
82
86
 
83
87
  def normalize_association_reference(api_attribute, model_attribute)
84
- if resource_association?(model_attribute)
88
+ if accepts_nested_attributes_for?(model_attribute)
89
+ api_attribute
90
+ elsif resource_association?(model_attribute)
85
91
  normalize_resource_association_reference(api_attribute)
86
92
  elsif collection_association?(model_attribute)
87
93
  normalize_collection_association_reference(api_attribute)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PackAPI
4
- VERSION = "1.0.4"
4
+ VERSION = "1.0.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pack_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flytedesk