dear_inventory 1.5.0 → 1.5.1
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 +4 -4
- data/lib/dear_inventory/model.rb +6 -10
- data/lib/dear_inventory/parameters/customer/show.rb +1 -1
- data/lib/dear_inventory/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0fb20442d0a660bc2e697213c166e928d164952bda1e531ad449c2356b85f9bc
|
|
4
|
+
data.tar.gz: 4aaeda28158aaf787e854af382d98a4f8ea20f01e805a40d1f3d0470bcde1ab6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7c632d01d244d518fa513c3baf4106d7a40ea0f202fec842e5c8db773257c66d1f839f255365187846a14f159a97f1285e43bd6e22e85a52ea797b19de1df094
|
|
7
|
+
data.tar.gz: 46cceddc01f75e88068b7878f85768c79334c16431fde2b0848f196d14caae5123b6ee11461183cff70f7933b8d85772848472f5419ae94fa1fa280f78738893
|
data/lib/dear_inventory/model.rb
CHANGED
|
@@ -38,7 +38,12 @@ module DearInventory
|
|
|
38
38
|
|
|
39
39
|
def to_h
|
|
40
40
|
{}.tap do |hash|
|
|
41
|
-
|
|
41
|
+
self.class.enumerate_fields do |_, specifications|
|
|
42
|
+
key = specifications[:name]
|
|
43
|
+
hash[key] = public_send(key)
|
|
44
|
+
|
|
45
|
+
nested_attributes_to_hash(hash[key]) if hash[key].is_a?(Array)
|
|
46
|
+
end
|
|
42
47
|
end
|
|
43
48
|
end
|
|
44
49
|
|
|
@@ -75,15 +80,6 @@ module DearInventory
|
|
|
75
80
|
# rubocop:enable Metrics/CyclomaticComplexity
|
|
76
81
|
# rubocop:enable Metrics/MethodLength
|
|
77
82
|
|
|
78
|
-
def attributes_to_hash(hash)
|
|
79
|
-
self.class.enumerate_fields do |_, specifications|
|
|
80
|
-
key = specifications[:name]
|
|
81
|
-
hash[key] = public_send(key)
|
|
82
|
-
|
|
83
|
-
nested_attributes_to_hash(hash[key]) if hash[key].is_a?(Array)
|
|
84
|
-
end
|
|
85
|
-
end
|
|
86
|
-
|
|
87
83
|
def nested_attributes_to_hash(collection)
|
|
88
84
|
collection.each_with_index do |record, index|
|
|
89
85
|
collection[index] = record.to_h
|