scim-kit 0.2.11 → 0.2.12

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: c837475f698f79135b950846ef1a3a066a30d99ef2c7b68b2e0f200583ae7448
4
- data.tar.gz: 715929f4b9e8124c4cdb4f5d4bc5ac2518e2c7f577dc0bf28ea68f7c2ca63b0e
3
+ metadata.gz: aafb2f3aa6f0b41a4ebde4b089882c524cf66d2e21f235ee052a0c675cc019c8
4
+ data.tar.gz: dd26edce1bcdde02047b660430ef1621b802f974b6e43575bf438c77c48d2a5b
5
5
  SHA512:
6
- metadata.gz: a9c38074c82da3dc850d5dd4d80205a0d82b47341777ac9038137462a40ce835c87f9a07137c0b2d2f9cd9b0dbeee02ffdbe2105e190751702f4ad9d8eef275b
7
- data.tar.gz: f99a726c0ab5f697f00892292900b6589c2356cec36d924e8220c479bf683c4ffbf4f0495f29c29199cab0f770a9e8a7e359f3475ee7b76a6f66fa04104ce130
6
+ metadata.gz: cc0f4f87fa2e6c74084e8e757ebdceac4ddf8837b11170a0b0a0947aa9637f3af7652b8605bf0c9fad796eef0d1f451f0dd87023f1ce9422cfc3d46c79372a49
7
+ data.tar.gz: c280082b331cb57b282ff72592e6f0a7b911032b3e2e8840c6b34d812b660817f64afcdb1656d57b26b20af3658420aedc7f96e3a75ee48cf1861f74033aa922
@@ -20,9 +20,9 @@ module Scim
20
20
 
21
21
  def read_attribute(name)
22
22
  attribute = attribute_for(name)
23
- return attribute._value if attribute.type.multi_valued
23
+ return attribute._value if attribute._type.multi_valued
24
24
 
25
- attribute.type.complex? ? attribute : attribute._value
25
+ attribute._type.complex? ? attribute : attribute._value
26
26
  end
27
27
 
28
28
  def write_attribute(name, value)
@@ -8,23 +8,23 @@ module Scim
8
8
  include ::ActiveModel::Validations
9
9
  include Attributable
10
10
  include Templatable
11
- attr_reader :type
11
+ attr_reader :_type
12
12
  attr_reader :_resource
13
13
  attr_reader :_value
14
14
 
15
- validate :presence_of_value, if: proc { |x| x.type.required }
16
- validate :inclusion_of_value, if: proc { |x| x.type.canonical_values }
15
+ validate :presence_of_value, if: proc { |x| x._type.required }
16
+ validate :inclusion_of_value, if: proc { |x| x._type.canonical_values }
17
17
  validate :validate_type
18
18
 
19
19
  def initialize(resource:, type:, value: nil)
20
- @type = type
20
+ @_type = type
21
21
  @_value = value || type.multi_valued ? [] : nil
22
22
  @_resource = resource
23
23
  define_attributes_for(resource, type.attributes)
24
24
  end
25
25
 
26
26
  def _assign(new_value, coerce: true)
27
- @_value = coerce ? type.coerce(new_value) : new_value
27
+ @_value = coerce ? _type.coerce(new_value) : new_value
28
28
  end
29
29
 
30
30
  def _value=(new_value)
@@ -50,33 +50,33 @@ module Scim
50
50
  end
51
51
 
52
52
  def restricted?
53
- _resource.mode?(:server) && type.returned == Returned::NEVER
53
+ _resource.mode?(:server) && _type.returned == Returned::NEVER
54
54
  end
55
55
 
56
56
  def presence_of_value
57
- return unless type.required && _value.blank?
57
+ return unless _type.required && _value.blank?
58
58
 
59
- errors.add(type.name, I18n.t('errors.messages.blank'))
59
+ errors.add(_type.name, I18n.t('errors.messages.blank'))
60
60
  end
61
61
 
62
62
  def inclusion_of_value
63
- return if type.canonical_values.include?(_value)
63
+ return if _type.canonical_values.include?(_value)
64
64
 
65
- errors.add(type.name, I18n.t('errors.messages.inclusion'))
65
+ errors.add(_type.name, I18n.t('errors.messages.inclusion'))
66
66
  end
67
67
 
68
68
  def validate_type
69
- return if type.valid?(_value)
69
+ return if _type.valid?(_value)
70
70
 
71
- errors.add(type.name, I18n.t('errors.messages.invalid'))
71
+ errors.add(_type.name, I18n.t('errors.messages.invalid'))
72
72
  end
73
73
 
74
74
  def read_only?
75
- type.mutability == Mutability::READ_ONLY
75
+ _type.mutability == Mutability::READ_ONLY
76
76
  end
77
77
 
78
78
  def write_only?
79
- type.mutability == Mutability::WRITE_ONLY
79
+ _type.mutability == Mutability::WRITE_ONLY
80
80
  end
81
81
  end
82
82
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  json.key_format! camelize: :lower
4
- if type.complex? && !type.multi_valued
5
- json.set! type.name do
4
+ if _type.complex? && !_type.multi_valued
5
+ json.set! _type.name do
6
6
  dynamic_attributes.values.each do |attribute|
7
7
  render attribute, json: json
8
8
  end
9
9
  end
10
10
  elsif renderable?
11
- json.set! type.name, _value
11
+ json.set! _type.name, _value
12
12
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Scim
4
4
  module Kit
5
- VERSION = '0.2.11'
5
+ VERSION = '0.2.12'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scim-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - mo