{"id":13880030,"url":"https://github.com/contentful/contentful.rb","last_synced_at":"2025-04-08T16:08:30.738Z","repository":{"id":14534386,"uuid":"17249099","full_name":"contentful/contentful.rb","owner":"contentful","description":"Ruby client for the Contentful Content Delivery API","archived":false,"fork":false,"pushed_at":"2024-07-16T14:09:52.000Z","size":657,"stargazers_count":138,"open_issues_count":5,"forks_count":64,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-04-01T15:10:00.571Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.contentful.com/developers/documentation/content-delivery-api/","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/contentful.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-02-27T13:11:22.000Z","updated_at":"2025-01-27T09:21:57.000Z","dependencies_parsed_at":"2023-02-19T20:01:23.099Z","dependency_job_id":"a3367932-06b3-49d9-8b31-48336640b39e","html_url":"https://github.com/contentful/contentful.rb","commit_stats":{"total_commits":278,"total_committers":47,"mean_commits":5.914893617021277,"dds":0.5503597122302158,"last_synced_commit":"4f57e0ca758e2f8ad4511204a9c4f33f714a3e9e"},"previous_names":[],"tags_count":73,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful.rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful.rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful.rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/contentful%2Fcontentful.rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/contentful","download_url":"https://codeload.github.com/contentful/contentful.rb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247878022,"owners_count":21011158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-06T08:02:44.314Z","updated_at":"2025-04-08T16:08:30.715Z","avatar_url":"https://github.com/contentful.png","language":"Ruby","funding_links":[],"categories":["Ruby"],"sub_categories":[],"readme":"![header](./.github/header.png)\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.contentful.com/slack/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/-Join%20Community%20Slack-2AB27B.svg?logo=slack\u0026maxAge=31557600\" alt=\"Join Contentful Community Slack\"\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca href=\"https://www.contentfulcommunity.com/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/-Join%20Community%20Forum-3AB2E6.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MiA1OSI+CiAgPHBhdGggZmlsbD0iI0Y4RTQxOCIgZD0iTTE4IDQxYTE2IDE2IDAgMCAxIDAtMjMgNiA2IDAgMCAwLTktOSAyOSAyOSAwIDAgMCAwIDQxIDYgNiAwIDEgMCA5LTkiIG1hc2s9InVybCgjYikiLz4KICA8cGF0aCBmaWxsPSIjNTZBRUQyIiBkPSJNMTggMThhMTYgMTYgMCAwIDEgMjMgMCA2IDYgMCAxIDAgOS05QTI5IDI5IDAgMCAwIDkgOWE2IDYgMCAwIDAgOSA5Ii8+CiAgPHBhdGggZmlsbD0iI0UwNTM0RSIgZD0iTTQxIDQxYTE2IDE2IDAgMCAxLTIzIDAgNiA2IDAgMSAwLTkgOSAyOSAyOSAwIDAgMCA0MSAwIDYgNiAwIDAgMC05LTkiLz4KICA8cGF0aCBmaWxsPSIjMUQ3OEE0IiBkPSJNMTggMThhNiA2IDAgMSAxLTktOSA2IDYgMCAwIDEgOSA5Ii8+CiAgPHBhdGggZmlsbD0iI0JFNDMzQiIgZD0iTTE4IDUwYTYgNiAwIDEgMS05LTkgNiA2IDAgMCAxIDkgOSIvPgo8L3N2Zz4K\u0026maxAge=31557600\"\n      alt=\"Join Contentful Community Forum\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n# contentful.rb - Contentful Ruby Delivery Library\n[![Gem Version](https://badge.fury.io/rb/contentful.png)](http://badge.fury.io/rb/contentful)\n\n\u003e Ruby library for the Contentful [Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/) and [Content Preview API](https://www.contentful.com/developers/docs/references/content-preview-api/). It helps you to easily access your Content stored in Contentful with your Ruby applications.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Status-Maintained-green.svg\" alt=\"This repository is actively maintained\" /\u003e \u0026nbsp;\n  \u003ca href=\"LICENSE.txt\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-brightgreen.svg\" alt=\"MIT License\" /\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca href=\"https://app.circleci.com/pipelines/github/contentful/contentful.rb?branch=master\"\u003e\n    \u003cimg src=\"https://circleci.com/gh/contentful/contentful.rb/tree/master.svg?style=svg\" alt=\"CircleCI\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://rubygems.org/gems/contentful\"\u003e\n    \u003cimg src=\"https://img.shields.io/gem/v/contentful.svg\" alt=\"RubyGems version\"\u003e\n  \u003c/a\u003e\n  \u0026nbsp;\n  \u003ca href=\"https://rubygems.org/gems/contentful\"\u003e\n    \u003cimg src=\"https://img.shields.io/gem/dt/contentful.svg\" alt=\"RubyGems downloads\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n**What is Contentful?**\n\n[Contentful](https://www.contentful.com/) provides content infrastructure for digital teams to power websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship their products faster.\n\n\u003cdetails\u003e\n\u003csummary\u003eTable of contents\u003c/summary\u003e\n\n\u003c!-- TOC --\u003e\n\n- [contentful.rb - Contentful Ruby Delivery library](#contentfulrb---contentful-ruby-delivery-library)\n  - [Core Features](#core-features)\n  - [Getting started](#getting-started)\n    - [Installation](#installation)\n    - [Your first request](#your-first-request)\n    - [Using this library with the Preview API](#using-this-library-with-the-preview-api)\n    - [Authentication](#authentication)\n  - [Documentation \u0026 References](#documentation--references)\n    - [Configuration](#configuration)\n    - [Reference documentation](#reference-documentation)\n      - [Basic queries](#basic-queries)\n      - [Filtering options](#filtering-options)\n      - [Accessing fields and sys properties](#accessing-fields-and-sys-properties)\n      - [Dynamic entries](#dynamic-entries)\n      - [Using different locales](#using-different-locales)\n      - [Arrays](#arrays)\n      - [Links](#links)\n      - [Assets](#assets)\n      - [Resource options](#resource-options)\n      - [Field type `Object`](#field-type-object)\n    - [Advanced concepts](#advanced-concepts)\n      - [Proxy example](#proxy-example)\n      - [Custom resource classes](#custom-resource-classes)\n      - [Synchronization](#synchronization)\n    - [Migrating to 2.x](#migrating-to-2x)\n    - [Tutorials \u0026 other resources](#tutorials--other-resources)\n  - [Reach out to us](#reach-out-to-us)\n    - [You have questions about how to use this library?](#you-have-questions-about-how-to-use-this-library)\n    - [You found a bug or want to propose a feature?](#you-found-a-bug-or-want-to-propose-a-feature)\n    - [You need to share confidential information or have other questions?](#you-need-to-share-confidential-information-or-have-other-questions)\n  - [Get involved](#get-involved)\n  - [License](#license)\n  - [Code of Conduct](#code-of-conduct)\n\n\u003c!-- /TOC --\u003e\n\n\u003c/details\u003e\n\n## Core Features\n\n- Content retrieval through [Content Delivery API](https://www.contentful.com/developers/docs/references/content-delivery-api/) and [Content Preview API](https://www.contentful.com/developers/docs/references/content-preview-api/).\n- [Synchronization](https://www.contentful.com/developers/docs/concepts/sync/)\n- [Localization support](https://www.contentful.com/developers/docs/concepts/locales/)\n- [Link resolution](https://www.contentful.com/developers/docs/concepts/links/)\n- Built in rate limiting recovery procedures\n- Supports [Environments](https://www.contentful.com/developers/docs/concepts/multiple-environments/) (**since v2.6.0 - 16. April 2018**)\n\n## Getting started\n\nIn order to get started with the Contentful Ruby library you'll need not only to install it, but also to get credentials which will allow you to have access to your content in Contentful.\n\n- [Installation](#installation)\n- [Your first request](#your-first-request)\n- [Using this library with the Preview API](#using-this-library-with-the-preview-api)\n- [Authentication](#authentication)\n- [Documentation \u0026 References](#documentation--references)\n\n### Installation\n\nAdd to your Gemfile and bundle:\n\n```bash\ngem 'contentful'\n```\n\nOr install it directly from your console:\n\n```bash\ngem i contentful\n```\n\n### Your first request\n\nThe following code snippet is the most basic one you can use to get some content from Contentful with this library:\n\n```ruby\nrequire 'contentful'\n\nclient = Contentful::Client.new(\n  space: 'cfexampleapi',  # This is the space ID. A space is like a project folder in Contentful terms\n  access_token: 'b4c0n73n7fu1'  # This is the access token for this space. Normally you get both ID and the token in the Contentful web app\n)\n\n# This API call will request an entry with the specified ID from the space defined at the top, using a space-specific access token.\nentry = client.entry('nyancat')\n```\n\n### Using this library with the Preview API\n\nThis library can also be used with the Preview API. In order to do so, you need to use the Preview API Access token, available on the same page where you get the Delivery API token, and specify the host of the preview API, such as:\n\n```ruby\nrequire 'contentful'\n\nclient = Contentful::Client.new(\n  space: 'cfexampleapi',\n  access_token: 'b4c0n73n7fu1',\n  api_url: 'preview.contentful.com'\n)\n```\n\nYou can query for entries, assets, etc. very similar as described in the\n[Delivery API Documentation](https://www.contentful.com/developers/docs/references/content-delivery-api/). Please note, that **all methods of the Ruby client library are snake_cased, instead of JavaScript's camelCase**:\n\n### Authentication\n\nTo get your own content from Contentful, an app should authenticate with an OAuth bearer token.\n\nYou can create API keys using the [Contentful web interface](https://app.contentful.com). Go to the app, open the space that you want to access (top left corner lists all the spaces), and navigate to the APIs area. Open the API Keys section and create your first token. Done.\n\nDon't forget to also get your Space ID.\n\nFor more information, check the [Contentful REST API reference on Authentication](https://www.contentful.com/developers/docs/references/authentication/).\n\n## Documentation \u0026 References\n\n- [Configuration](#configuration)\n- [Reference documentation](#reference-documentation)\n- [Tutorials \u0026 other resources](#tutorials--other-resources)\n- [Advanced Concepts](#advanced-concepts)\n- [Migrating to 2.x](#migrating-to-2x)\n\n\nTo help you get the most out of this library, we've prepared all available client configuration options, reference documentation, tutorials and other examples that will help you learn and understand how to use this library.\n\n### Configuration\n\nThe client constructor supports several options you may set to achieve the expected behavior:\n\n```ruby\nclient = Contentful::Client.new(\n  # ... your options here ...\n)\n```\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003eName\u003c/th\u003e\n      \u003cth\u003eDefault\u003c/th\u003e\n      \u003cth\u003eDescription\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eaccess_token\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eRequired\u003c/strong\u003e. Your access token.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003espace\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cstrong\u003eRequired\u003c/strong\u003e. Your space ID.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eenvironment\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e'master'\u003c/td\u003e\n      \u003ctd\u003eYour environment ID.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eapi_url\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e'cdn.contentful.com'\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eSet the host used to build the request URIs.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003edefault_locale\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e'en-US'\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eDefines default locale for the client.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003esecure\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eDefines whether to use HTTPS or HTTP. By default we use HTTPS.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eauthentication_mechanism\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e:header\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eSets the authentication mechanisms, valid options are \u003ccode\u003e:header\u003c/code\u003e or \u003ccode\u003e:query_string\u003c/code\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eraise_errors\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eDetermines whether errors are raised or returned.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eraise_for_empty_fields\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eDetermines whether \u003ccode\u003eEmptyFieldError\u003c/code\u003e is raised when empty fields are requested on an entry or \u003ccode\u003enil\u003c/code\u003e is returned.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003edynamic_entries\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e:manual\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        Determines if content type caching is enabled automatically or not,\n        allowing for accessing of fields even when they are not present on the response.\n        Valid options are \u003ccode\u003e:auto\u003c/code\u003e and \u003ccode\u003e:manual\u003c/code\u003e.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eraw_mode\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eIf enabled, API responses are not parsed and the raw response object is returned instead.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eresource_mapping\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e{}\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eAllows for overriding default resource classes with custom ones.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eentry_mapping\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e{}\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eAllows for overriding of specific entry classes by content type.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003egzip_encoded\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003etrue\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eEnables gzip response content encoding.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003emax_rate_limit_retries\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e1\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        To increase or decrease the retry attempts after a 429 Rate Limit error. Default value is 1. Using 0 will disable retry behaviour.\n        Each retry will be attempted after the value (in seconds) of the \u003ccode\u003eX-Contentful-RateLimit-Reset\u003c/code\u003e header,\n        which contains the amount of seconds until the next non rate limited request is available, has passed.\n        This is blocking per execution thread.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003emax_rate_limit_wait\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e60\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        Maximum time to wait for next available request (in seconds). Default value is 60 seconds.\n        Keep in mind that if you hit the hourly rate limit maximum, you can have up to 60 minutes of blocked requests.\n        It is set to a default of 60 seconds in order to avoid blocking processes for too long, as rate limit retry behaviour\n        is blocking per execution thread.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003emax_include_resolution_depth\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e20\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        Maximum amount of levels to resolve includes for library entities\n        (this is independent of API-level includes - it represents the maximum depth the include resolution\n        tree is allowed to resolved before falling back to \u003ccode\u003eLink\u003c/code\u003e objects).\n        This include resolution strategy is in place in order to avoid having infinite circular recursion on resources with circular dependencies.\n        \u003cstrong\u003eNote\u003c/strong\u003e: If you're using something like \u003ccode\u003eRails::cache\u003c/code\u003e it's advisable to considerably lower this value\n        (around 5 has proven to be a good compromise - but keep it higher or equal than your maximum API-level include parameter if you need the entire tree resolution).\n        Note that when \u003ccode\u003ereuse_entries\u003c/code\u003e is enabled, the max include resolution depth only affects\n        deep chains of unique objects (ie, not simple circular references).\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003ereuse_entries\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        When enabled, reuse hydrated Entry and Asset objects within the same request when possible.\n        Can result in a large speed increase and better handles cyclical object graphs.\n        This can be a good alternative to \u003ccode\u003emax_include_resolution_depth\u003c/code\u003e if your content model contains (or can contain) circular references.\n        \u003cstrong\u003eCaching may break if this option is enabled, as it may generate stack errors.\u003c/strong\u003e\n        When caching, deactivate this option and opt for a conservative \u003ccode\u003emax_include_resolution_depth\u003c/code\u003e value.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003euse_camel_case\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003efalse\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        When doing the v2 upgrade, all keys and accessors were changed to always use \u003ccode\u003esnake_case\u003c/code\u003e.\n        This option introduces the ability to use \u003ccode\u003ecamelCase\u003c/code\u003e for keys and method accessors.\n        This is very useful for isomorphic applications.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eproxy_host\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eTo be able to perform a request behind a proxy, this needs to be set. It can be a domain or IP address of the proxy server.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eproxy_port\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eSpecify the port number that is used by the proxy server for client connections.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eproxy_username\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eUsername for proxy authentication.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003eproxy_password\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003ePassword for proxy authentication.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003etimeout_read\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eNumber of seconds the request waits to read from the server before timing out.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003etimeout_write\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eNumber of seconds the request waits when writing to the server before timing out.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003etimeout_connect\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eNumber of seconds the request waits to connect to the server before timing out.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003elogger\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003enil\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003eTo enable logging pass a logger instance compatible with \u003ccode\u003e::Logger\u003c/code\u003e.\u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr\u003e\n      \u003ctd\u003e\u003ccode\u003elog_level\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003ccode\u003e::Logger::INFO\u003c/code\u003e\u003c/td\u003e\n      \u003ctd\u003e\n        The default severity is set to INFO and logs only the request attributes (headers, parameters and url).\n        Setting it to DEBUG will also log the raw JSON response.\n        WARNING: Setting this will override the level on the logger instance. Leave out this key to preserve\n        the original log_level on the logger, for example when using Rails.logger.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n### Reference documentation\n\n#### Basic queries\n\n```ruby\ncontent_types = client.content_types\ncat_content_type = client.content_type 'cat'\nnyancat = client.entry 'nyancat'\nentries = client.entries\nassets = client.assets\nnyancat_asset = client.asset 'nyancat'\n```\n\n#### Filtering options\n\nYou can pass the usual filter options to the query:\n\n```ruby\nclient.entries(content_type: 'cat') # query for a content-type by its ID (not name)\nclient.entries('sys.id[ne]' =\u003e 'nyancat') # query for all entries except 'nyancat'\nclient.entries(include: 1) # include one level of linked resources\nclient.entries(content_type: 'cat', include: 1) # you can also combine multiple parameters\n```\n\nTo read more about filtering options you can check our [search parameters documentation](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters).\n\nThe results are returned as `Contentful::BaseResource` objects. Multiple results will be returned as `Contentful::Array`.\nThe properties of a resource can be accessed through Ruby methods.\n\n#### Accessing fields and sys properties\n\n```ruby\ncontent_type = client.content_type 'cat'\ncontent_type.description # \"Meow.\"\n```\n\nSystem Properties behave the same and can be accessed via the `#sys` method.\n\n```ruby\ncontent_type.id # =\u003e 'cat'\nentry.type # =\u003e 'Entry'\nasset.sys # { id: '...', type: '...' }\n```\n\nEntry fields also have direct accessors and will be coerced to the type defined in it's content type.\nHowever, if using `dynamic_entries: :manual`, coercion will not be done.\n\n```ruby\nentry = client.entry 'nyancat'\nentry.fields[:color] # 'rainbow'\nentry.color # 'rainbow'\nentry.birthday # #\u003cDateTime: 2011-04-04T22:00:00+00:00 ((2455656j,79200s,0n),+0s,2299161j)\u003e\n```\n\n#### Accessing tags\n\nTags can be accessed via the `#_metadata` method.\n\n```ruby\nentry = client.entry 'nyancat'\nentry._metadata[:tags] # =\u003e [\u003cContentful::Link id='tagID'\u003e]\n```\n\n#### Dynamic entries\n\nHowever, you can (and should) set `:dynamic_entries` to `:auto` in your client configuration.\nWhen using this option, the client will cache all available content types and use them to hydrate entries when fields are missing in the response and coerce fields to their proper types.\n\n```ruby\nclient = Contentful::Client.new(\n  access_token: 'b4c0n73n7fu1',\n  space: 'cfexampleapi',\n  dynamic_entries: :auto\n)\n\nentry = client.entry 'nyancat' # =\u003e #\u003cContentful::Entry[cat]: ...\u003e\nentry.color # =\u003e 'rainbow'\nentry.birthday # #\u003cDateTime: 2011-04-04T22:00:00+00:00 ((2455656j,79200s,0n),+0s,2299161j)\u003e\n```\n\nDynamic entries will have getter classes for the fields and do type conversions properly.\n\nThe `:auto` mode will fetch all content types on initialization. If you want to do it by hand later, you will need to set the option to `:manual` and call `client.update_dynamic_entry_cache!` to initialize the cache.\n\n#### Using different locales\n\nEntries can have multiple locales, by default, the client only fetches the entry with only its default locale.\nIf you want to fetch a different locale you can do the following:\n\n```ruby\nentries = client.entries(locale: 'de-DE')\n```\n\nThen all the fields will be fetched for the requested locale.\n\nContentful Delivery API also allows to fetch all locales, you can do so by doing:\n\n```ruby\nentries = client.entries(content_type: 'cat', locale: '*')\n\n# assuming the entry has a field called name\nmy_spanish_name = entries.first.fields('es-AR')[:name]\n```\n\nWhen requesting multiple locales, the object accessor shortcuts only work for the default locale.\n\n#### Arrays\n\nContentful::Array has an `#each` method that delegates to its items. It also includes Ruby's Enumerable module, providing methods like `#min` or `#first`. See the Ruby core documentation for further details.\n\nArrays also have a `#next_page` URL, which will rerun the request with a increased skip parameter, as described in [the documentation](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/search-parameters/skip).\n\n\n#### Links\n\nYou can easily request a resource that is represented by a link by calling `#resolve`:\n\n```ruby\nhappycat = client.entry 'happycat'\nhappycat.image\n# =\u003e #\u003cContentful::Link: @sys={:type=\u003e\"Link\", :linkType=\u003e\"Asset\", :id=\u003e\"happycat\"}\u003e\nhappycat.image.resolve(client) # =\u003e #\u003cContentful::Asset: @fields={ ...\n```\n\n### Assets\n\nThere is a helpful method to add image resize options for an asset image:\n\n```ruby\nclient.asset('happycat').url\n# =\u003e \"//images.contentful.com/cfexampleapi/3MZPnjZTIskAIIkuuosCss/\n#     382a48dfa2cb16c47aa2c72f7b23bf09/happycatw.jpg\"\n\nclient.asset('happycat').url(width: 300, height: 200, format: 'jpg', quality: 100)\n# =\u003e \"//images.contentful.com/cfexampleapi/3MZPnjZTIskAIIkuuosCss/\n#     382a48dfa2cb16c47aa2c72f7b23bf09/happycatw.jpg?w=300\u0026h=200\u0026fm=jpg\u0026q=100\"\n```\n\n#### Resource options\n\nResources, that have been requested directly (i.e. no child resources), can be fetched from the server again by calling `#reload`:\n\n```ruby\nentries = client.entries\nentries.reload # Fetches the array of entries again\n```\n\n#### Field type `Object`\n\nWhile for known field types, the field data is accessible using methods or the `#fields` hash with symbol keys, it behaves differently for nested data of the type \"Object\".\nThe client will treat them as arbitrary hashes and will not parse the data inside.\n\n\n### Advanced concepts\n\n#### Proxy example\n\n```ruby\nclient = Contentful::Client.new(\n  access_token: 'b4c0n73n7fu1',\n  space: 'cfexampleapi',\n  proxy_host: '127.0.0.1',\n  proxy_port: 8080,\n  proxy_username: 'username',\n  proxy_password: 'secret_password',\n)\n```\n\n#### Custom resource classes\n\nYou can define your own classes that will be returned instead of the predefined ones. Consider, you want to build a better Asset class. One way to do this is:\n\n```ruby\nclass MyBetterAsset \u003c Contentful::Asset\n  def https_image_url\n    image_url.sub %r\u003c\\A//\u003e, 'https://'\n  end\nend\n```\n\nYou can register your custom class on client initialization:\n\n```ruby\nclient = Contentful::Client.new(\n  space: 'cfexampleapi',\n  access_token: 'b4c0n73n7fu1',\n  resource_mapping: {\n    'Asset' =\u003e MyBetterAsset\n  }\n)\n```\n\nMore information on `:resource_mapping` can be found in [examples/resource_mapping.rb](./examples/resource_mapping.rb)\nand more on custom classes in [examples/custom_classes.rb](./examples/custom_classes.rb).\n\nYou can also register custom entry classes to be used based on the entry's content_type using the `:entry_mapping` configuration:\n\n```ruby\nclass Cat \u003c Contentful::Entry\n  # define methods based on :fields, etc\nend\n\nclient = Contentful::Client.new(\n  space: 'cfexampleapi',\n  access_token: 'b4c0n73n7fu1',\n  entry_mapping: {\n    'cat' =\u003e Cat\n  }\n)\n\nclient.entry('nyancat') # is instance of Cat\n```\n\n#### Synchronization\n\nThe client also includes a wrapper for the synchronization endpoint.\nYou can initialize it with the options described in the\n[Delivery API Documentation](https://www.contentful.com/developers/docs/references/content-delivery-api/#/reference/synchronization)\nor an URL you received from a previous sync:\n\n```ruby\nclient = Contentful::Client.new(\n  access_token: 'b4c0n73n7fu1',\n  space: 'cfexampleapi',\n  default_locale: 'en-US'\n)\n\nsync = client.sync(initial: true, type: 'Deletion') # Only returns deleted entries and assets\nsync = client.sync(\"https://cdn.contentful.com/spaces/cfexampleapi/sync?sync_token=w5ZGw6JFwqZmVcKsE8Kow4gr...sGPg\") # Continues a sync\n```\n\nYou can access the results either wrapped in `Contentful::SyncPage` objects:\n\n```ruby\nsync.each_page do |page|\n  # Find resources at: page.items\nend\n\n# More explicit version:\npage = sync.first_page\nuntil sync.completed?\n  page = sync.next_page\nend\n```\n\nOr directly iterative over all resources:\n\n```ruby\nsync.each_item do |resource|\n  # ...\nend\n```\n\nWhen a sync is completed, the next sync url can be read from the Sync or SyncPage object:\n\n```ruby\nsync.next_sync_url\n```\n\n**Please note** that synchronization entries come in all locales, so make sure, you supply a :default_locale property to the client configuration, when using the sync feature. This locale will be returned by default, when you call `Entry#fields`. The other localized data will also be saved and can be accessed by calling the fields method with a locale parameter:\n\n```ruby\nfirst_entry = client.sync(initial: true, type: 'Entry').first_page.items.first\nfirst_entry.fields('de-DE') # Returns German localizations\n```\n\n### Migrating to 2.x\n\nIf you're a `0.x` or a `1.x` user of this gem, and are planning to migrate to the current `2.x` branch.\nThere are a few breaking changes you have to take into account:\n\n* `Contentful::Link#resolve` and `Contentful::Array#next_page` now require a `Contentful::Client` instance as a parameter.\n* `Contentful::CustomResource` does no longer exist, custom entry classes can now inherit from `Contentful::Entry` and have proper marshalling working.\n* `Contentful::Resource` does no longer exist, all resource classes now inherit from `Contentful::BaseResource`. `Contentful::Entry` and `Contentful::Asset` inherit from `Contentful::FieldsResource` which is a subclass of `Contentful::BaseResource`.\n* `Contentful::DynamicEntry` does no longer exist, if code checked against that base class, it should now check against `Contentful::Entry` instead.\n* `Contentful::Client#dynamic_entry_cache` _(private)_ has been extracted to it's own class, and can be now manually cleared by using `Contentful::ContentTypeCache::clear`.\n* `Contentful::BaseResource#sys` and `Contentful::FieldsResource#fields` internal representation for keys are now snake cased to match the instance accessors. E.g. `entry.fields[:myField]` previously had the accessor `entry.my_field`, now it is `entry.fields[:my_field]`. The value in both cases would correspond to the same field, only change is to unify the style. If code accessed the values through the `#sys` or `#fields` methods, keys now need to be snake cased.\n* Circular references are handled as individual objects to simplify marshalling and reduce stack errors, this introduces a performance hit on extremely interconnected content. Therefore, to limit the impact of circular references, an additional configuration flag `max_include_resolution_depth` has been added. It is set to 20 by default (which corresponds to the maximum include level value * 2). This allows for non-circular but highly connected content to resolve properly. In very interconnected content, it also allows to reduce this number to improve performance. For a more in depth look into this you can read [this issue](https://github.com/contentful/contentful.rb/issues/124#issuecomment-287002469).\n* `#inspect` now offers a clearer and better output for all resources. If your code had assertions based on the string representation of the resources, update to the new format `\u003cContentful::#{RESOURCE_CLASS}#{additional_info} id=\"#{RESOURCE_ID}\"\u003e`.\n\nFor more information on the internal changes present in the 2.x release, please read the [CHANGELOG](CHANGELOG.md)\n\n### Tutorials \u0026 other resources\n\n* This library is a wrapper around our Contentful Delivery REST API. Some more specific details such as search parameters and pagination are better explained on the [REST API reference](https://www.contentful.com/developers/docs/references/content-delivery-api/), and you can also get a better understanding of how the requests look under the hood.\n* Check the [Contentful for Ruby](https://www.contentful.com/developers/docs/ruby/) page for Tutorials, Demo Apps, and more information on other ways of using Ruby with Contentful\n\n## Reach out to us\n\n### You have questions about how to use this library?\n* Reach out to our community forum: [![Contentful Community Forum](https://img.shields.io/badge/-Join%20Community%20Forum-3AB2E6.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MiA1OSI+CiAgPHBhdGggZmlsbD0iI0Y4RTQxOCIgZD0iTTE4IDQxYTE2IDE2IDAgMCAxIDAtMjMgNiA2IDAgMCAwLTktOSAyOSAyOSAwIDAgMCAwIDQxIDYgNiAwIDEgMCA5LTkiIG1hc2s9InVybCgjYikiLz4KICA8cGF0aCBmaWxsPSIjNTZBRUQyIiBkPSJNMTggMThhMTYgMTYgMCAwIDEgMjMgMCA2IDYgMCAxIDAgOS05QTI5IDI5IDAgMCAwIDkgOWE2IDYgMCAwIDAgOSA5Ii8+CiAgPHBhdGggZmlsbD0iI0UwNTM0RSIgZD0iTTQxIDQxYTE2IDE2IDAgMCAxLTIzIDAgNiA2IDAgMSAwLTkgOSAyOSAyOSAwIDAgMCA0MSAwIDYgNiAwIDAgMC05LTkiLz4KICA8cGF0aCBmaWxsPSIjMUQ3OEE0IiBkPSJNMTggMThhNiA2IDAgMSAxLTktOSA2IDYgMCAwIDEgOSA5Ii8+CiAgPHBhdGggZmlsbD0iI0JFNDMzQiIgZD0iTTE4IDUwYTYgNiAwIDEgMS05LTkgNiA2IDAgMCAxIDkgOSIvPgo8L3N2Zz4K\u0026maxAge=31557600)](https://support.contentful.com/)\n* Jump into our community slack channel: [![Contentful Community Slack](https://img.shields.io/badge/-Join%20Community%20Slack-2AB27B.svg?logo=slack\u0026maxAge=31557600)](https://www.contentful.com/slack/)\n\n### You found a bug or want to propose a feature?\n\n* File an issue here on GitHub: [![File an issue](https://img.shields.io/badge/-Create%20Issue-6cc644.svg?logo=github\u0026maxAge=31557600)](https://github.com/contentful/contentful.rb/issues/new). Make sure to remove any credentials from your code before sharing it.\n\n### You need to share confidential information or have other questions?\n\n* File a support ticket at our Contentful Customer Support: [![File support ticket](https://img.shields.io/badge/-Submit%20Support%20Ticket-3AB2E6.svg?logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1MiA1OSI+CiAgPHBhdGggZmlsbD0iI0Y4RTQxOCIgZD0iTTE4IDQxYTE2IDE2IDAgMCAxIDAtMjMgNiA2IDAgMCAwLTktOSAyOSAyOSAwIDAgMCAwIDQxIDYgNiAwIDEgMCA5LTkiIG1hc2s9InVybCgjYikiLz4KICA8cGF0aCBmaWxsPSIjNTZBRUQyIiBkPSJNMTggMThhMTYgMTYgMCAwIDEgMjMgMCA2IDYgMCAxIDAgOS05QTI5IDI5IDAgMCAwIDkgOWE2IDYgMCAwIDAgOSA5Ii8+CiAgPHBhdGggZmlsbD0iI0UwNTM0RSIgZD0iTTQxIDQxYTE2IDE2IDAgMCAxLTIzIDAgNiA2IDAgMSAwLTkgOSAyOSAyOSAwIDAgMCA0MSAwIDYgNiAwIDAgMC05LTkiLz4KICA8cGF0aCBmaWxsPSIjMUQ3OEE0IiBkPSJNMTggMThhNiA2IDAgMSAxLTktOSA2IDYgMCAwIDEgOSA5Ii8+CiAgPHBhdGggZmlsbD0iI0JFNDMzQiIgZD0iTTE4IDUwYTYgNiAwIDEgMS05LTkgNiA2IDAgMCAxIDkgOSIvPgo8L3N2Zz4K\u0026maxAge=31557600)](https://www.contentful.com/support/)\n\n## Get involved\n\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?maxAge=31557600)](http://makeapullrequest.com)\n\nWe appreciate any help on our repositories. For more details about how to contribute see our [CONTRIBUTING.md](CONTRIBUTING.md) document.\n\n## License\n\nThis repository is published under the [MIT](LICENSE.txt) license.\n\n## Code of Conduct\n\nWe want to provide a safe, inclusive, welcoming, and harassment-free space and experience for all participants, regardless of gender identity and expression, sexual orientation, disability, physical appearance, socioeconomic status, body size, ethnicity, nationality, level of experience, age, religion (or lack thereof), or other identity markers.\n\n[Read our full Code of Conduct](https://github.com/contentful-developer-relations/community-code-of-conduct).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentful%2Fcontentful.rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcontentful%2Fcontentful.rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcontentful%2Fcontentful.rb/lists"}