simple_sdk_builder 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
  SHA1:
3
- metadata.gz: f82878b214bb216a9ae2977480538696638a2925
4
- data.tar.gz: 170d457d986c70807d0d220ce7aad24de59369bd
3
+ metadata.gz: 5818f4d32c72e5a037e88698119cd3a195e58422
4
+ data.tar.gz: 67d32132c035061361a449235fa6b4479b160419
5
5
  SHA512:
6
- metadata.gz: 9782bfda0f658aee2f072b2d2d78527a9048d68f1b8ff0e80753144f449d982239b52517bf8d64d54bd119601fe9c3037a98419ead6174454ab371371ce14550
7
- data.tar.gz: b0dcae0a18200528dff62ff7c431b7ab58c3d80ac394b9c01ed954a0e2689894eaf83fbcfa1462653ad2ca7258c4fae92d28ecce4262ac8994be397ba7776422
6
+ metadata.gz: f81a2a36d539ab03e2e3859074d38689fdcbaae653d9ade11dd7d72478422919b5ab711b81bb8ac1f46e74e18a110c339c34db5fbb21cfe49d0bc73bc06f27e9
7
+ data.tar.gz: 67d1a23c9f2dca2b9bf126f09ad3c9612efc783817ad40c1bf2f30e5947266ff8143d6a2d760289be4c8abb66c11608be85841e7dceebbb20f3251a35ddab006
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,8 @@
1
1
  = Simple SDK Builder
2
2
 
3
+ == Version 1.2.0
4
+ * Adding ability to designate a nested attribute as "signular", so it will be nil instead of an empty array when missing
5
+
3
6
  == Version 1.1.1
4
7
  * Handling resources without an id
5
8
 
@@ -103,13 +103,14 @@ module Resource
103
103
 
104
104
  def simple_sdk_nested_attribute(attr, options = {})
105
105
  options = {
106
- :nested => true
106
+ nested: true,
107
+ singular: false
107
108
  }.merge(options)
108
109
  attr = attr.to_s
109
110
  simple_sdk_attributes.push(attr)
110
111
  simple_sdk_attributes.push("#{attr}_attributes") # for ActiveRecord nested attributes
111
112
  define_method attr do
112
- @attributes[attr] ||= []
113
+ @attributes[attr] ||= options[:singular] ? nil : []
113
114
  end
114
115
  alias_method :"#{attr}_attributes", :"#{attr}" # for ActiveRecord nested attributes
115
116
  define_method "#{attr}=" do |value|
@@ -1,3 +1,3 @@
1
1
  module SimpleSDKBuilder
2
- VERSION = '1.1.1'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_sdk_builder
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
  - David Dawson