Commit d5183d2

mo <mo.khan@gmail.com>
2019-01-08 03:29:54
allow resource to specify multiple schemas
1 parent 90899ba
Changed files (2)
lib
scim
spec
scim
lib/scim/kit/v2/resource.rb
@@ -12,10 +12,12 @@ module Scim
         attr_reader :meta
         attr_reader :schemas
 
-        def initialize(schema:, location:)
-          @meta = Meta.new(schema.name, location)
-          @schemas = [schema]
-          define_attributes_for(schema.attributes)
+        def initialize(schemas:, location:)
+          @meta = Meta.new(schemas[0].name, location)
+          @schemas = schemas
+          schemas.each do |schema|
+            define_attributes_for(schema.attributes)
+          end
         end
       end
     end
spec/scim/kit/v2/resource_spec.rb
@@ -1,7 +1,7 @@
 # frozen_string_literal: true
 
 RSpec.describe Scim::Kit::V2::Resource do
-  subject { described_class.new(schema: schema, location: resource_location) }
+  subject { described_class.new(schemas: [schema], location: resource_location) }
 
   let(:schema) { Scim::Kit::V2::Schema.new(id: Scim::Kit::V2::Schemas::USER, name: 'User', location: FFaker::Internet.uri('https')) }
   let(:resource_location) { FFaker::Internet.uri('https') }