contentful / contentful_model

A lightweight wrapper around the Contentful api gem, to make it behave more like ActiveRecord
MIT License
44 stars 42 forks source link

Delivery and Management API specific options #135

Closed klevo closed 5 years ago

klevo commented 5 years ago

This is to allow to pass different configuration values of the same option to Delivery and Management clients.

It's needed if we want to say configure the Delivery API to fail quickly as we don't want to hog page rendering, and on the other hand let Management API take as long as needed in the same app, as those queries are not run by visitors and don't have to be fast.

config.options = {
    # Optional:
    # Use `delivery_api` and `management_api` keys to limit to what API the settings
    # will apply. Useful because Delivery API is usually visitor facing, while Management
    # is used in background tasks that can run much longer. For example:
    delivery_api: {
      timeout_read: 6
    },
    management_api: {
      timeout_read: 100
    }
}

Also in this PR webmock was updated to latest version, because the previous version was causing VCR fails when running test suite locally or on Travis. This bug: https://www.bountysource.com/issues/54892151-twitter-gem-vcr-request-initialized-with-an-invalid-body

klevo commented 5 years ago

The CI is finally green.