Sha256: 582e145c3a823a6ad7fb7d17c7440bf795e4d7fa68f7267a270f34c45055fc26
Contents?: true
Size: 575 Bytes
Versions: 16
Compression:
Stored size: 575 Bytes
Contents
# frozen_string_literal: true class WCC::Contentful::Link attr_reader :id attr_reader :link_type attr_reader :raw LINK_TYPES = { Asset: 'Asset', Link: 'Entry' }.freeze def initialize(model, link_type = nil) @id = model.try(:id) || model @link_type = link_type @link_type ||= model.is_a?(WCC::Contentful::Model::Asset) ? :Asset : :Link @raw = { 'sys' => { 'type' => 'Link', 'linkType' => LINK_TYPES[@link_type] || link_type, 'id' => @id } } end alias_method :to_h, :raw end
Version data entries
16 entries across 16 versions & 1 rubygems