Sha256: f890d16c8bebf490a0a13dd7bfb1341d994e176830639f68121dfbf8172234d6

Contents?: true

Size: 713 Bytes

Versions: 6

Compression:

Stored size: 713 Bytes

Contents

# -*- encoding: utf-8 -*-
require_relative 'resource'

module Contentful
  module Management
    # Resource Class for Links
    # https://www.contentful.com/developers/documentation/content-delivery-api/#links
    class Link
      include Contentful::Management::Resource
      include Contentful::Management::Resource::SystemProperties

      # Queries contentful for the Resource the Link is referring to
      # Takes an optional query hash
      def resolve(query = {})
        id_and_query = [(id unless link_type == 'Space')].compact + [query]
        client.public_send(
            Contentful::Management::Support.snakify(link_type).to_sym,
            *id_and_query
        )
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
contentful-management-0.2.1 lib/contentful/management/link.rb
contentful-management-0.2.0 lib/contentful/management/link.rb
contentful-management-0.1.0 lib/contentful/management/link.rb
contentful-management-0.0.3 lib/contentful/management/link.rb
contentful-management-0.0.2 lib/contentful/management/link.rb
contentful-management-0.0.1 lib/contentful/management/link.rb