Class: ContentfulModel::Client
- Inherits:
-
Contentful::Client
- Object
- Contentful::Client
- ContentfulModel::Client
- Defined in:
- lib/contentful_model/client.rb
Overview
Wrapper for the CDA Client
Constant Summary collapse
- PREVIEW_API_URL =
'preview.contentful.com'.freeze
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(configuration) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/contentful_model/client.rb', line 8 def initialize(configuration) configuration[:resource_mapping] = configuration.fetch(:resource_mapping, {}).merge( 'Asset' => ContentfulModel::Asset ) if ContentfulModel.use_preview_api configuration[:api_url] = PREVIEW_API_URL configuration[:access_token] = configuration[:preview_access_token] end configuration = { raise_errors: true, dynamic_entries: :auto, integration_name: 'contentful_model', integration_version: ::ContentfulModel::VERSION, raise_for_empty_fields: false }.merge(configuration) # Apply delivery specific options (if any) if configuration[:delivery_api] configuration.merge!(configuration[:delivery_api]) end super(configuration) end |