Class: Hotchoc::File

Inherits:
Base
  • Object
show all
Defined in:
lib/hotchoc/file.rb

Instance Attribute Summary

Attributes inherited from Base

#item

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Hotchoc::Base

Instance Method Details

#content_typeObject



27
28
29
# File 'lib/hotchoc/file.rb', line 27

def content_type
  @item['content_type']
end

#created_atObject



44
45
46
# File 'lib/hotchoc/file.rb', line 44

def created_at
  Time.parse(@item['created_at'])
end

#exifObject



40
41
42
# File 'lib/hotchoc/file.rb', line 40

def exif
  @item['exif']
end

#heightObject



19
20
21
# File 'lib/hotchoc/file.rb', line 19

def height
  @item['height']
end

#idObject



3
4
5
# File 'lib/hotchoc/file.rb', line 3

def id
  @item['id']
end

#inspectObject



52
53
54
# File 'lib/hotchoc/file.rb', line 52

def inspect
  %(#<Hotchoc::File: name="#{name}">)
end

#nameObject



7
8
9
# File 'lib/hotchoc/file.rb', line 7

def name
  @item['name']
end

#sizeObject



23
24
25
# File 'lib/hotchoc/file.rb', line 23

def size
  @item['size']
end

#thumbnailsObject



31
32
33
34
35
36
37
38
# File 'lib/hotchoc/file.rb', line 31

def thumbnails
  if @item['thumbnails']
    @item['thumbnails']['original'].map { |thumbnail| Hotchoc::Thumbnail.new(thumbnail) } +
      @item['thumbnails']['square'].map { |thumbnail| Hotchoc::Thumbnail.new(thumbnail) }
  else
    []
  end
end

#updated_atObject



48
49
50
# File 'lib/hotchoc/file.rb', line 48

def updated_at
  Time.parse(@item['updated_at'])
end

#urlObject



11
12
13
# File 'lib/hotchoc/file.rb', line 11

def url
  @item['url']
end

#widthObject



15
16
17
# File 'lib/hotchoc/file.rb', line 15

def width
  @item['width']
end