Class: Committee::ResponseGenerator

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

Instance Method Summary collapse

Instance Method Details

#call(link) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/committee/response_generator.rb', line 3

def call(link)
  schema = target_schema(link)
  data = generate_properties(link, schema)

  # List is a special case; wrap data in an array.
  #
  # This is poor form that's here so as not to introduce breaking behavior.
  # The "instances" value of "rel" is a Heroku-ism and was originally
  # introduced before we understood how to use "targetSchema". It's not
  # meaningful with the context of the hyper-schema specification and
  # should be eventually be removed.
  if legacy_hyper_schema_rel?(link)
    data = [data]
  end

  [data, schema]
end