Class: TapRep::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/schema.rb

Overview

Models a JSON Schema required for Singer taps

Defined Under Namespace

Classes: Types

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stream, key_property) ⇒ Schema

Returns a new instance of Schema.



9
10
11
12
# File 'lib/schema.rb', line 9

def initialize(stream, key_property)
  @stream = stream
  @key_property = key_property
end

Instance Attribute Details

#key_propertyObject (readonly)

Returns the value of attribute key_property.



7
8
9
# File 'lib/schema.rb', line 7

def key_property
  @key_property
end

#streamObject (readonly)

Returns the value of attribute stream.



7
8
9
# File 'lib/schema.rb', line 7

def stream
  @stream
end

Instance Method Details

#propertiesObject



50
51
52
# File 'lib/schema.rb', line 50

def properties
  @properties ||= {}
end

#to_hashObject



54
55
56
57
58
59
60
61
62
63
# File 'lib/schema.rb', line 54

def to_hash
  {
    type: :SCHEMA,
    stream: stream,
    key_properties: [key_property],
    schema: {
      properties: properties
    }
  }
end