Sha256: f934cd9e2578f14a444498227552db1a1fd72a1d9e0d0b719253a2687a960b23

Contents?: true

Size: 590 Bytes

Versions: 27

Compression:

Stored size: 590 Bytes

Contents

require_relative 'resource'

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

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

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
contentful-1.2.2 lib/contentful/link.rb
contentful-1.2.1 lib/contentful/link.rb
contentful-1.2.0 lib/contentful/link.rb
contentful-1.1.1 lib/contentful/link.rb
contentful-1.1.0 lib/contentful/link.rb
contentful-1.0.2 lib/contentful/link.rb
contentful-1.0.1 lib/contentful/link.rb
contentful-1.0.0 lib/contentful/link.rb
contentful-0.12.0 lib/contentful/link.rb
contentful-0.11.0 lib/contentful/link.rb
contentful-0.10.0 lib/contentful/link.rb
contentful-0.9.0 lib/contentful/link.rb
contentful-0.8.0 lib/contentful/link.rb
contentful-0.7.0 lib/contentful/link.rb
contentful-0.6.0 lib/contentful/link.rb
contentful-0.5.0 lib/contentful/link.rb
contentful-0.4.0 lib/contentful/link.rb
contentful-0.3.5 lib/contentful/link.rb
contentful-0.3.4 lib/contentful/link.rb
contentful-0.3.3 lib/contentful/link.rb