Class: ContentfulLite::Asset

Inherits:
Object
  • Object
show all
Includes:
CommonData
Defined in:
lib/contentful_lite/asset.rb

Instance Attribute Summary

Attributes included from CommonData

#created_at, #default_locale, #environment_id, #id, #locales, #localized_fields, #retrieved_at, #revision, #space_id, #sys, #updated_at

Instance Method Summary collapse

Methods included from CommonData

#as_json, #fields, #initialize, #locale, #locale=, #to_link, #with_locale

Instance Method Details

#content_typeObject

Returns the content_type attribute of the Contentful Asset



26
# File 'lib/contentful_lite/asset.rb', line 26

asset_attribute :content_type, ['file', 'contentType']

Gets the URL to view/edit the entry on Contentful webapp

Returns:

  • (String)


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

def contentful_link
  "https://app.contentful.com/spaces/#{space_id}/assets/#{id}"
end

#descriptionObject

Returns the description attribute of the Contentful Asset



24
# File 'lib/contentful_lite/asset.rb', line 24

asset_attribute :description, ['description'], default: ''

#file_detailsObject

Returns the file_details attribute of the Contentful Asset



28
# File 'lib/contentful_lite/asset.rb', line 28

asset_attribute :file_details, ['file', 'details']

#file_nameObject

Returns the file_name attribute of the Contentful Asset



25
# File 'lib/contentful_lite/asset.rb', line 25

asset_attribute :file_name, ['file', 'fileName']

#titleObject

Returns the title attribute of the Contentful Asset



23
# File 'lib/contentful_lite/asset.rb', line 23

asset_attribute :title, ['title']

#urlObject

Returns the url attribute of the Contentful Asset



27
# File 'lib/contentful_lite/asset.rb', line 27

asset_attribute :url, ['file', 'url']