stbaldricks 7.0.1.alpha.1 → 8.0.0.alpha.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: 8de249f5d8fdbdded42b25ee1e867a28870105db98325adfdfd642818606c0d1
4
- data.tar.gz: eb9586cd8e42d73eafa924c10d2094bb881a781466129888c414e95caf22640f
3
+ metadata.gz: 2c8d55de515a40ab9cba96b243667a0ab969aa75a1c1b3d2514b666fa8a3e368
4
+ data.tar.gz: f70f5e91783a796cad7d29078e573296c450910b36bc505d97bf6c524cf13409
5
5
  SHA512:
6
- metadata.gz: 597f933b64433c14178a91d922de9ee7098968ef90921bfb2462b41e19df901e722f22be9be04b7dff9a8d13476f1ad3d24f8fd3ec6bc83884f28aa81a9c30b8
7
- data.tar.gz: 4d22aeed629e28a61ce9ace7a18b7228f7c365190c0d723e8df0c09bf251a81cb63b7df81e401f53eb67ec60ea4cd71a2910eccf829209214e73bb0af3a7f50b
6
+ metadata.gz: 475231650f38a94d84779c0eae763844526f9fc6f642a93599897c29bcac80e46001300c55cdc757411752a20bc8cc73c3b85aba75c169a957617e7547b85577
7
+ data.tar.gz: a7690725f350cf6d792d6e8c94a24a913ea959d4cd2ff1ed9a8e069810540b4a2fcc24458d1b764199b7cd262e676319ef661173e6a9dad4e15b0e67971db46d
@@ -169,11 +169,11 @@ module SBF
169
169
  def sanitize(data, entity_class = nil)
170
170
  klass = entity_class || target_class
171
171
 
172
- return sanitize(data, klass) if klass.attributes.empty?
172
+ return sanitize(data, klass) if klass.defined_attributes.empty?
173
173
 
174
174
  {}.tap do |hsh|
175
175
  data.each do |key, value|
176
- next unless klass.attributes.include?(key)
176
+ next unless klass.defined_attributes.include?(key)
177
177
 
178
178
  # We need to sanitize the sub objects if the value is a sub-entity
179
179
  if klass.entity_attributes.include?(key)
@@ -36,7 +36,7 @@ module SBF
36
36
 
37
37
  def to_hash
38
38
  {}.tap do |hsh|
39
- self.class.attributes.each { |name| hsh[name] = send(name.to_sym) unless name.to_sym == :year }
39
+ self.class.defined_attributes.each { |name| hsh[name] = send(name.to_sym) unless name.to_sym == :year }
40
40
  end
41
41
  end
42
42
  end
@@ -23,7 +23,7 @@ module SBF
23
23
  ELSE = ->(_) { true }
24
24
 
25
25
  # Class level instance variable to keep track of defined attributes
26
- @attributes = nil
26
+ @defined_attributes = nil
27
27
  @optional_attributes = nil
28
28
  @entity_attributes = nil
29
29
  @not_provided_attributes = nil
@@ -125,7 +125,7 @@ module SBF
125
125
  # For each attribute that may be optional, call mark_attribute_not_provided
126
126
  # if the data set does not contain a key with the optional attribute's name
127
127
  self.class.optional_attributes.each { |name| mark_attribute_not_provided(name) unless data.key?(name) }
128
- @attributes ||= Set.new
128
+ @defined_attributes ||= Set.new
129
129
  @optional_attributes ||= Set.new
130
130
  @not_provided_attributes ||= Set.new
131
131
  @entity_attributes ||= Set.new
@@ -225,13 +225,13 @@ module SBF
225
225
  # Override for the ruby built-in attribute accessors. Creates a list of attributes that can be
226
226
  # accessed at will and adds some helper methods.
227
227
  def self.attr_reader(*vars)
228
- attributes.merge(vars)
228
+ defined_attributes.merge(vars)
229
229
  super(*vars)
230
230
  add_boolean_methods(vars)
231
231
  end
232
232
 
233
233
  def self.attr_writer(*vars)
234
- attributes.merge(vars)
234
+ defined_attributes.merge(vars)
235
235
 
236
236
  vars.each do |attribute|
237
237
  define_attribute_methods attribute
@@ -242,7 +242,7 @@ module SBF
242
242
  end
243
243
 
244
244
  def self.attr_accessor(*vars)
245
- attributes.merge(vars)
245
+ defined_attributes.merge(vars)
246
246
  super(*vars)
247
247
 
248
248
  vars.each do |attribute|
@@ -344,8 +344,8 @@ module SBF
344
344
  end
345
345
  ###########################################################################################
346
346
 
347
- def self.attributes
348
- @attributes ||= Set.new
347
+ def self.defined_attributes
348
+ @defined_attributes ||= Set.new
349
349
  end
350
350
 
351
351
  def self.optional_attributes
@@ -405,7 +405,7 @@ module SBF
405
405
  raise SBF::Client::Error, "unknown #{attribute} type" if check.nil?
406
406
 
407
407
  # If a user specifies exactly the partial fields, then this should be a partial.
408
- return partial_class if partial_class && (value.keys - partial_class.attributes.to_a).empty?
408
+ return partial_class if partial_class && (value.keys - partial_class.defined_attributes.to_a).empty?
409
409
 
410
410
  # Otherwise
411
411
  return full_class if full_class
@@ -538,7 +538,7 @@ module SBF
538
538
  # Recursively converts an entity into a Hash
539
539
  def to_hash
540
540
  entity_hash = {}
541
- self.class.attributes.each { |key|
541
+ self.class.defined_attributes.each { |key|
542
542
  # If the method was not retrieved, do not include it in the hash
543
543
  next if not_provided_attributes.include?(key)
544
544
 
@@ -579,7 +579,7 @@ module SBF
579
579
 
580
580
  def self.inherited(base)
581
581
  # Add all of our attributes to the class that is inheriting us.
582
- base.attributes.merge(attributes) unless attributes.empty?
582
+ base.defined_attributes.merge(defined_attributes) unless defined_attributes.empty?
583
583
  base.optional_attributes.merge(optional_attributes) unless optional_attributes.empty?
584
584
  base.entity_attributes.merge(entity_attributes) unless entity_attributes.empty?
585
585
  end
@@ -27,7 +27,7 @@ module SBF
27
27
  def to_hash
28
28
  {}.tap do |hsh|
29
29
  props.each { |k, v| hsh[k] = v }
30
- self.class.attributes.each { |name| hsh[name] = send(name.to_sym) unless hsh.key?(name.to_sym) || name.to_sym == :props }
30
+ self.class.defined_attributes.each { |name| hsh[name] = send(name.to_sym) unless hsh.key?(name.to_sym) || name.to_sym == :props }
31
31
  end
32
32
  end
33
33
  end
@@ -1,5 +1,5 @@
1
1
  module SBF
2
2
  module Client
3
- VERSION = '7.0.1.alpha.1'
3
+ VERSION = '8.0.0.alpha.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stbaldricks
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.1.alpha.1
4
+ version: 8.0.0.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-13 00:00:00.000000000 Z
11
+ date: 2019-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel