watermarkchurch / wcc-contentful

An alternative to Contentful's contentful.rb ruby client, contentful_model, and contentful_rails gems all in one.
MIT License
2 stars 1 forks source link

Make use of Contentful API `include` param for link resolution #38

Closed gburgett closed 6 years ago

gburgett commented 6 years ago

The content delivery API has an include= query param which can resolve up to 10 levels of linked data.
Documentation here: https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/links/retrieval-of-linked-items

Expose this functionality on the SimpleClient and CDN Adapter interfaces.

Also, PR #36 introduced the following function on all WCC::Contentful::Model instances:

def resolve(depth: 1, fields: nil, context: {})

Update this function to take advantage of the include param on the store adapter, falling back to the recursive method when include does not resolve all the wanted levels.