class SchemaRegistry::Subject

Attributes

client[R]
name[R]

Public Class Methods

new(client, name) click to toggle source
# File lib/schema_registry/subject.rb, line 21
def initialize(client, name)
  @client, @name = client, name
end

Public Instance Methods

compatibility_level() click to toggle source
# File lib/schema_registry/subject.rb, line 48
def compatibility_level
  response = client.request(:get, "/config/#{name}")
  response["compatibilityLevel"]
end
compatibility_level=(level) click to toggle source
# File lib/schema_registry/subject.rb, line 53
def compatibility_level=(level)
  client.request(:put, "/config/#{name}", compatibility: level)
end
compatible?(schema, version = "latest") click to toggle source
# File lib/schema_registry/subject.rb, line 57
def compatible?(schema, version = "latest")
  response = client.request(:post, "/compatibility/subjects/#{name}/versions/#{version}", schema: schema)
  response["is_compatible"]
end
register_schema(schema_json) click to toggle source
# File lib/schema_registry/subject.rb, line 44
def register_schema(schema_json)
  client.request(:post, "/subjects/#{name}/versions", schema: schema_json)['id']
end
schema_registered?(schema_json) click to toggle source
# File lib/schema_registry/subject.rb, line 37
def schema_registered?(schema_json)
  verify_schema(schema_json)
  true
rescue SubjectNotFound, SchemaNotFound
  false
end
verify_schema(schema_json) click to toggle source
# File lib/schema_registry/subject.rb, line 33
def verify_schema(schema_json)
  SchemaRegistration.new(self, client.request(:post, "/subjects/#{name}", schema: schema_json))
end
version(version) click to toggle source
# File lib/schema_registry/subject.rb, line 29
def version(version)
  SchemaRegistration.new(self, client.request(:get, "/subjects/#{name}/versions/#{version}"))
end
versions() click to toggle source
# File lib/schema_registry/subject.rb, line 25
def versions
  client.request(:get, "/subjects/#{name}/versions")
end