json_resource 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c5d0ad6feca66b6bd7524037d69edf9da40ba45c5f25a6441ef4543d174e5ad
4
- data.tar.gz: 6ee0efc65381f5243b3da05ef710dc7a8ea6e296708e2a4224c680b728fb9331
3
+ metadata.gz: f26ed85c08a888e816d5bece3c37bd373c6fb61df4042e80cd0bcb371dbfd23a
4
+ data.tar.gz: 48bc07b4f66618f635591dc24de3195ca19eb6fb8a2a253b6fe9d32f1de6ac8b
5
5
  SHA512:
6
- metadata.gz: f534f05c6e7748186cfb3373c3b55c5891d0c572be08b917f380d4cf49443a60dbdda258a3dda9778edd9b623eb4f4d45cff2c5223423c8ad450cacfde050030
7
- data.tar.gz: 0f7703523f9b619ce117fb889fd6f9eba4738a6ceeed9d5e043edc54c1c057f25ba4d788da958b2a7121ddd93a5688787477618f0a247ff294305b804dc89a77
6
+ metadata.gz: c041eb4bf88f877a95f2330ec8d3c066b62621290d3f30a1121216c9eb57d1625282c5d3c0bfc34f23bfe96e345a7cbf43d7f3b5f72c6299a450f6f862983a0c
7
+ data.tar.gz: dd98b1e2d0e4fd314e848b3b777a31d1c5a33791c4f161e0dc452fdfcb9da0e6d7ed7c5beaf4115598bcdf6b6d12e2669bf6660300c9223b693ad7dafd7f12d7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 1.2.0 - 2024-11-06
2
+
3
+ - Add underscore inflection name
4
+ - Fix has_attributes
5
+
1
6
  ## 1.1.0 – 2023-11-01
2
7
 
3
8
  - Improve BigDecimal conversion
@@ -68,9 +68,9 @@ module JsonResource
68
68
  attribute_accessor_method name
69
69
  end
70
70
 
71
- def attributes(*args)
71
+ def has_attributes(*args)
72
72
  options = args.extract_options!
73
- args.each { |arg| has_attribute arg, options }
73
+ args.each { |arg| attribute arg, options }
74
74
  end
75
75
 
76
76
  def has_object(name, options = {})
@@ -186,7 +186,7 @@ module JsonResource
186
186
  string.camelcase(:upper)
187
187
  when :dasherize
188
188
  string.underscore.dasherize
189
- when nil
189
+ when nil, :underscore
190
190
  string.underscore
191
191
  else
192
192
  string.public_send(inflection)
@@ -202,7 +202,19 @@ module JsonResource
202
202
  def symbolize_keys
203
203
  transform_keys(&:to_sym)
204
204
  end
205
-
205
+
206
+ end
207
+
208
+ refine Array do
209
+
210
+ def extract_options!
211
+ if last.is_a?(Hash) && last.instance_of?(Hash)
212
+ pop
213
+ else
214
+ {}
215
+ end
216
+ end
217
+
206
218
  end
207
219
 
208
220
  end
@@ -1,3 +1,3 @@
1
1
  module JsonResource
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthias Grosser
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-02 00:00:00.000000000 Z
11
+ date: 2024-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -24,7 +24,21 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description:
27
+ - !ruby/object:Gem::Dependency
28
+ name: bigdecimal
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
28
42
  email:
29
43
  - mtgrosser@gmx.net
30
44
  executables: []
@@ -44,7 +58,7 @@ homepage: https://github.com/mtgrosser/json_resource
44
58
  licenses:
45
59
  - MIT
46
60
  metadata: {}
47
- post_install_message:
61
+ post_install_message:
48
62
  rdoc_options: []
49
63
  require_paths:
50
64
  - lib
@@ -52,15 +66,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
52
66
  requirements:
53
67
  - - ">="
54
68
  - !ruby/object:Gem::Version
55
- version: 2.7.0
69
+ version: 3.2.0
56
70
  required_rubygems_version: !ruby/object:Gem::Requirement
57
71
  requirements:
58
72
  - - ">="
59
73
  - !ruby/object:Gem::Version
60
74
  version: '0'
61
75
  requirements: []
62
- rubygems_version: 3.1.4
63
- signing_key:
76
+ rubygems_version: 3.5.11
77
+ signing_key:
64
78
  specification_version: 4
65
79
  summary: Create Ruby objects from JSON data
66
80
  test_files: []