Class: Imgur::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/imgur.rb

Overview

Represents an image on Imgur

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Image

Returns a new instance of Image.



164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/imgur.rb', line 164

def initialize(data)
  @id = data['id']
  @title = data['title']
  @description = data['description']
  @date = Time.at data['datetime']
  @type = data['type']
  @animated = data['animated']
  @width = data['width']
  @height = data['height']
  @size = data['size']
  @views = data['views']
  @bandwidth = data['bandwidth']
  @favorite = data['favorite']
  @nsfw = data['nsfw']
  @section = data['section']
  @deletehash = data['deletehash']
  @link = data['link']
  @html_link = HTML_PATH + @id
end

Instance Attribute Details

#animatedObject

Returns the value of attribute animated.



151
152
153
# File 'lib/imgur.rb', line 151

def animated
  @animated
end

#bandwidthObject

Returns the value of attribute bandwidth.



156
157
158
# File 'lib/imgur.rb', line 156

def bandwidth
  @bandwidth
end

#dateObject

Time object of :datetime



149
150
151
# File 'lib/imgur.rb', line 149

def date
  @date
end

#deletehashObject

Returns the value of attribute deletehash.



160
161
162
# File 'lib/imgur.rb', line 160

def deletehash
  @deletehash
end

#descriptionObject

Returns the value of attribute description.



148
149
150
# File 'lib/imgur.rb', line 148

def description
  @description
end

#favoriteObject

Returns the value of attribute favorite.



157
158
159
# File 'lib/imgur.rb', line 157

def favorite
  @favorite
end

#heightObject

Returns the value of attribute height.



153
154
155
# File 'lib/imgur.rb', line 153

def height
  @height
end

Returns the value of attribute html_link.



162
163
164
# File 'lib/imgur.rb', line 162

def html_link
  @html_link
end

#idObject

Returns the value of attribute id.



146
147
148
# File 'lib/imgur.rb', line 146

def id
  @id
end

Returns the value of attribute link.



161
162
163
# File 'lib/imgur.rb', line 161

def link
  @link
end

#nsfwObject

Returns the value of attribute nsfw.



158
159
160
# File 'lib/imgur.rb', line 158

def nsfw
  @nsfw
end

#sectionObject

Returns the value of attribute section.



159
160
161
# File 'lib/imgur.rb', line 159

def section
  @section
end

#sizeObject

Returns the value of attribute size.



154
155
156
# File 'lib/imgur.rb', line 154

def size
  @size
end

#titleObject

Returns the value of attribute title.



147
148
149
# File 'lib/imgur.rb', line 147

def title
  @title
end

#typeObject

Returns the value of attribute type.



150
151
152
# File 'lib/imgur.rb', line 150

def type
  @type
end

#viewsObject

Returns the value of attribute views.



155
156
157
# File 'lib/imgur.rb', line 155

def views
  @views
end

#widthObject

Returns the value of attribute width.



152
153
154
# File 'lib/imgur.rb', line 152

def width
  @width
end