Commit 2a217214 authored by Bruno Nocera Zanette's avatar Bruno Nocera Zanette
Browse files

modify SchemaRegistry model names

parent 317c1990
......@@ -18,8 +18,8 @@ require_relative "dspace/builders/tempfile_builder"
require_relative "dspace/community"
require_relative "dspace/collection"
require_relative "dspace/item"
require_relative "dspace/metadata"
require_relative "dspace/schema_registry"
require_relative "dspace/metadata_field"
require_relative "dspace/schema"
require_relative "dspace/field"
require_relative "dspace/bitstream"
require_relative "dspace/policy"
......
module Dspace
class MetadataField
include Dspace::Builders::HashBuilder
attr_accessor :name, :element, :description, :qualifier
attr_reader :id, :parentSchema, :expand
def initialize(args={})
@id = args['fieldId']
@name = args['name']
@element = args['element']
@description = args['description']
@qualifier = args['qualifier']
@parentSchema = args['parentSchema']
@expand = args['expand']
end
def to_h
{
fieldId: @id,
name: @name,
element: @element,
description: @description,
qualifier: @qualifier,
parentSchema: @parentSchema,
expand: @expand
}
end
end
end
module Dspace
class Schema
include Dspace::Builders::HashBuilder
attr_accessor :namespace, :prefix, :expand
attr_reader :id, :fields
def initialize(args={})
@id = args['schemaID']
@namespace = args['namespace']
@prefix = args['prefix']
@expand = args['expand']
@fields = Dspace::Builders::ModelBuilder.build_fields(args['fields'])
end
def to_h
{
schemaID: @id,
namespace: @namespace,
prefix: @prefix,
expand: @expand,
fields: @fields
}
end
def add_field(name, element, description)
f = {}
f['name'] = name
f['element'] = element
f['description'] = description
@fields << Dspace::Field.new(f)
@fields
end
def reset_fields
@fields = []
end
end
end
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment