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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71b2b64af358567bd4f1a475d081aafd3c00150872a11fb7628fdbfbb97dc2c7
4
- data.tar.gz: 0c4caf15c3e4b827f08062219c903e33110e01576f3c7cbce7baa7f834299a6c
3
+ metadata.gz: 0fb20442d0a660bc2e697213c166e928d164952bda1e531ad449c2356b85f9bc
4
+ data.tar.gz: 4aaeda28158aaf787e854af382d98a4f8ea20f01e805a40d1f3d0470bcde1ab6
5
5
  SHA512:
6
- metadata.gz: 0b4196a33a0f47a82bee9dd375e30d24ffd560fd9f122dc88a3cd24278edd118a5bb729ee1fe8e71077b7b290561fbdd857cad0656f15a3a783fbedf272f0250
7
- data.tar.gz: 59c6329f0930b9d1e8ca0324fb00171172cc5bb05f6bf0b90dd441d8701a4eecc2b378fa1c1e7a35546bf919b39e293572766e79dd78b52a6ee8f7c221781122
6
+ metadata.gz: 7c632d01d244d518fa513c3baf4106d7a40ea0f202fec842e5c8db773257c66d1f839f255365187846a14f159a97f1285e43bd6e22e85a52ea797b19de1df094
7
+ data.tar.gz: 46cceddc01f75e88068b7878f85768c79334c16431fde2b0848f196d14caae5123b6ee11461183cff70f7933b8d85772848472f5419ae94fa1fa280f78738893
@@ -38,7 +38,12 @@ module DearInventory
38
38
 
39
39
  def to_h
40
40
  {}.tap do |hash|
41
- attributes_to_hash(hash)
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
@@ -8,7 +8,7 @@ module DearInventory
8
8
  id: {
9
9
  property: :ID,
10
10
  type: :Guid,
11
- required: true,
11
+ required: false,
12
12
  },
13
13
  account_receivable: {
14
14
  property: :AccountReceivable,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DearInventory
4
- VERSION = "1.5.0"
4
+ VERSION = "1.5.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dear_inventory
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Rice