hudu 0.3.2 → 0.3.3
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/CHANGELOG.md +4 -0
- data/lib/hudu/asset_helper.rb +5 -5
- data/lib/hudu/configuration.rb +1 -1
- data/lib/hudu/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 101911f730e28e20fcfe50f7677d7656163703bd1cb81b4fad5aebf8ff1b0084
|
4
|
+
data.tar.gz: 121eafb2cd99b4d24b0156c4f08065c005dc6bc839f1a805c117f5e7c5a332a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ec13aa4eaaf14f114a0043946269a9074e1ea307dce01e1ad15decb857d5b5b72530a87bcb1f9c56b33fe4a9eb2292a72adebd897b9df934b1d62baf2cff6b5
|
7
|
+
data.tar.gz: 6ff6828af1e8e7a26366ec4b8341d4cdeb6a57fa33db124aa7bdabf92c347a03787d00abab07b8be22d171311c8ce9aa8d188f3be128d14e315cc24b8cb6013b
|
data/CHANGELOG.md
CHANGED
data/lib/hudu/asset_helper.rb
CHANGED
@@ -11,20 +11,20 @@ module Hudu
|
|
11
11
|
# @example
|
12
12
|
# asset = SomeAssetEntity.new(attributes: { id: 1, name: "Asset 1", company_id: 101 }, fields: [field1, field2])
|
13
13
|
# Hudu::AssetHelper.construct_asset(asset)
|
14
|
-
# # => { asset:
|
14
|
+
# # => { asset:
|
15
15
|
# # { id: 1, company_id: 101, asset_layout_id: nil, slug: nil, name: "Asset 1", custom_fields: [...]
|
16
16
|
# # }
|
17
17
|
# # }
|
18
18
|
def self.construct_asset(asset)
|
19
19
|
custom_asset = asset.attributes.slice(
|
20
20
|
*%w[
|
21
|
-
|
21
|
+
asset_layout_id name
|
22
22
|
primary_serial primary_model primary_mail
|
23
23
|
primary_manufacturer
|
24
24
|
]
|
25
25
|
)
|
26
26
|
custom_asset['custom_fields'] = custom_fields(asset.fields)
|
27
|
-
|
27
|
+
custom_asset
|
28
28
|
end
|
29
29
|
|
30
30
|
# Creates a new asset from the given layout and fields.
|
@@ -51,7 +51,7 @@ module Hudu
|
|
51
51
|
# Formats custom fields into a standardized hash structure.
|
52
52
|
#
|
53
53
|
# @param fields [Array<Object>] A collection of field objects, each expected to respond to `label` and `value`.
|
54
|
-
# @return [Array<Hash>] An array containing a single hash mapping field labels
|
54
|
+
# @return [Array<Hash>] An array containing a single hash mapping field labels
|
55
55
|
# (downcased and underscored) to their values.
|
56
56
|
#
|
57
57
|
# @example
|
@@ -59,7 +59,7 @@ module Hudu
|
|
59
59
|
# Hudu::AssetHelper.custom_fields(fields)
|
60
60
|
# # => [{ "warranty" => "2025", "location" => "NYC" }]
|
61
61
|
def self.custom_fields(fields)
|
62
|
-
|
62
|
+
fields.map { |field| { field.label.downcase.gsub(' ', '_') => field.value.to_s } }
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
data/lib/hudu/configuration.rb
CHANGED
@@ -17,7 +17,7 @@ module Hudu
|
|
17
17
|
|
18
18
|
DEFAULT_UA = "Ruby Hudu API wrapper #{Hudu::VERSION}"
|
19
19
|
DEFAULT_PAGINATION = RequestPagination::PagingInfoPager
|
20
|
-
DEFAULT_PAGE_SIZE =
|
20
|
+
DEFAULT_PAGE_SIZE = 25
|
21
21
|
|
22
22
|
# When this module is extended, set all configuration options to their default values
|
23
23
|
def self.extended(base)
|
data/lib/hudu/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hudu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janco Tanis
|
8
8
|
bindir: exe
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-09-10 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: faraday
|