Class: Audiences::Scim::Resource
- Inherits:
-
Object
- Object
- Audiences::Scim::Resource
- Defined in:
- lib/audiences/scim/resource.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#options ⇒ Object
Returns the value of attribute options.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, attributes: [], **options) ⇒ Resource
constructor
A new instance of Resource.
- #query(**options) ⇒ Object
- #scim_attributes ⇒ Object
Constructor Details
#initialize(type:, attributes: [], **options) ⇒ Resource
Returns a new instance of Resource.
8 9 10 11 12 |
# File 'lib/audiences/scim/resource.rb', line 8 def initialize(type:, attributes: [], **) @type = type @options = @attributes = ["id", "externalId", "displayName", *attributes] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/audiences/scim/resource.rb', line 6 def attributes @attributes end |
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/audiences/scim/resource.rb', line 6 def @options end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/audiences/scim/resource.rb', line 6 def type @type end |
Instance Method Details
#query(**options) ⇒ Object
14 15 16 17 18 |
# File 'lib/audiences/scim/resource.rb', line 14 def query(**) ResourcesQuery.new(Scim.client, resource: self, attributes: scim_attributes, **@options, **) end |
#scim_attributes ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/audiences/scim/resource.rb', line 20 def scim_attributes @attributes.reduce([]) do |attrs, attr| case attr when Hash attrs + attr.map do |key, nested_attrs| nested_attrs.map { "#{key}.#{_1}" } end else attrs + [attr] end end.join(",") end |