Class: ContentfulModel::Asset

Inherits:
Contentful::Asset
  • Object
show all
Includes:
AssetDimensions
Defined in:
lib/contentful_model/asset.rb

Overview

Module for providing querying capabilities to Asset

Class Method Summary collapse

Methods included from AssetDimensions

#format, #height, #jpeg_quality, #load, #padded_background_color, #png_8bit, #query, #resize, #resize_behavior, #rounded_corners, #thumbnail_focused_on, #width

Class Method Details

.all(query = {}) ⇒ Object



9
10
11
# File 'lib/contentful_model/asset.rb', line 9

def all(query = {})
  client.assets(query)
end

.clientObject



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/contentful_model/asset.rb', line 17

def client
  if ContentfulModel.use_preview_api
    @preview_client ||= ContentfulModel::Client.new(
      ContentfulModel.configuration.to_hash
    )
  else
    @client ||= ContentfulModel::Client.new(
      ContentfulModel.configuration.to_hash
    )
  end
end

.find(id) ⇒ Object



13
14
15
# File 'lib/contentful_model/asset.rb', line 13

def find(id)
  client.asset(id)
end