Method: ContentfulLite::Link#initialize

Defined in:
lib/contentful_lite/link.rb

#initialize(input) ⇒ Link

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Link.

Parameters:

  • data to build the instance

API:

  • private



11
12
13
14
15
16
17
18
19
# File 'lib/contentful_lite/link.rb', line 11

def initialize(input)
  if input.is_a?(ContentfulLite::CommonData)
    @id = input.id
    @type = input.sys['type'].downcase.to_sym
  else
    @type = input['sys']['linkType'].downcase.to_sym
    @id = input['sys']['id']
  end
end