lib/wcc/contentful/model_singleton_methods.rb in wcc-contentful-1.0.8 vs lib/wcc/contentful/model_singleton_methods.rb in wcc-contentful-1.1.0

- old
+ new

@@ -10,13 +10,13 @@ # for this content type, or nil if the ID does not exist in the space. # @example # WCC::Contentful::Model::Page.find(id) def find(id, options: nil) options ||= {} - store = store(options[:preview]) + store = options[:preview] ? services.preview_store : services.store raw = - WCC::Contentful::Instrumentation.instrument 'find.model.contentful.wcc', + _instrumentation.instrument 'find.model.contentful.wcc', content_type: content_type, id: id, options: options do store.find(id, { hint: type }.merge!(options.except(:preview))) end new(raw, options) if raw.present? end @@ -32,13 +32,13 @@ filter = filter&.dup options = filter&.delete(:options) || {} filter.transform_keys! { |k| k.to_s.camelize(:lower) } if filter.present? - store = store(options[:preview]) + store = options[:preview] ? services.preview_store : services.store query = - WCC::Contentful::Instrumentation.instrument 'find_all.model.contentful.wcc', + _instrumentation.instrument 'find_all.model.contentful.wcc', content_type: content_type, filter: filter, options: options do store.find_all(content_type: content_type, options: options.except(:preview)) end query = query.apply(filter) if filter.present? ModelQuery.new(query, options, self) @@ -54,12 +54,12 @@ filter = filter&.dup options = filter&.delete(:options) || {} filter.transform_keys! { |k| k.to_s.camelize(:lower) } if filter.present? - store = store(options[:preview]) + store = options[:preview] ? services.preview_store : services.store result = - WCC::Contentful::Instrumentation.instrument 'find_by.model.contentful.wcc', + _instrumentation.instrument 'find_by.model.contentful.wcc', content_type: content_type, filter: filter, options: options do store.find_by(content_type: content_type, filter: filter, options: options.except(:preview)) end new(result, options) if result