Class: PageImageSerializer

Inherits:
ActiveModel::Serializer
  • Object
show all
Includes:
DynamicImage::Helper
Defined in:
app/serializers/page_image_serializer.rb

Instance Method Summary collapse

Instance Method Details

#alternativeObject


12
13
14
# File 'app/serializers/page_image_serializer.rb', line 12

def alternative
  object.image.alternative
end

#captionObject


16
17
18
# File 'app/serializers/page_image_serializer.rb', line 16

def caption
  object.image.caption
end

#created_atObject


28
29
30
# File 'app/serializers/page_image_serializer.rb', line 28

def created_at
  object.image.created_at
end

#filenameObject


20
21
22
# File 'app/serializers/page_image_serializer.rb', line 20

def filename
  object.image.filename
end

#nameObject


8
9
10
# File 'app/serializers/page_image_serializer.rb', line 8

def name
  object.image.name
end

#sizeObject


24
25
26
# File 'app/serializers/page_image_serializer.rb', line 24

def size
  object.image.crop_size
end

#urlObject


32
33
34
35
36
37
38
39
# File 'app/serializers/page_image_serializer.rb', line 32

def url
  dynamic_image_path(
    object.image,
    size: "2000x2000",
    crop: false,
    upscale: false
  )
end