Sha256: fe5edb96e0c3d67af8a0c2a62766b0651dab1004900fa8f03f8ebd357c84fcb7
Contents?: true
Size: 549 Bytes
Versions: 14
Compression:
Stored size: 549 Bytes
Contents
# frozen_string_literal: true class WCC::Contentful::Link attr_reader :id, :link_type, :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
14 entries across 14 versions & 1 rubygems