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.



256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/imgur.rb', line 256

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.



243
244
245
# File 'lib/imgur.rb', line 243

def animated
  @animated
end

#bandwidthObject

Returns the value of attribute bandwidth.



248
249
250
# File 'lib/imgur.rb', line 248

def bandwidth
  @bandwidth
end

#dateObject

Time object of :datetime



241
242
243
# File 'lib/imgur.rb', line 241

def date
  @date
end

#deletehashObject

Returns the value of attribute deletehash.



252
253
254
# File 'lib/imgur.rb', line 252

def deletehash
  @deletehash
end

#descriptionObject

Returns the value of attribute description.



240
241
242
# File 'lib/imgur.rb', line 240

def description
  @description
end

#favoriteObject

Returns the value of attribute favorite.



249
250
251
# File 'lib/imgur.rb', line 249

def favorite
  @favorite
end

#heightObject

Returns the value of attribute height.



245
246
247
# File 'lib/imgur.rb', line 245

def height
  @height
end

Returns the value of attribute html_link.



254
255
256
# File 'lib/imgur.rb', line 254

def html_link
  @html_link
end

#idObject

Returns the value of attribute id.



238
239
240
# File 'lib/imgur.rb', line 238

def id
  @id
end

Returns the value of attribute link.



253
254
255
# File 'lib/imgur.rb', line 253

def link
  @link
end

#nsfwObject

Returns the value of attribute nsfw.



250
251
252
# File 'lib/imgur.rb', line 250

def nsfw
  @nsfw
end

#sectionObject

Returns the value of attribute section.



251
252
253
# File 'lib/imgur.rb', line 251

def section
  @section
end

#sizeObject

Returns the value of attribute size.



246
247
248
# File 'lib/imgur.rb', line 246

def size
  @size
end

#titleObject

Returns the value of attribute title.



239
240
241
# File 'lib/imgur.rb', line 239

def title
  @title
end

#typeObject

Returns the value of attribute type.



242
243
244
# File 'lib/imgur.rb', line 242

def type
  @type
end

#viewsObject

Returns the value of attribute views.



247
248
249
# File 'lib/imgur.rb', line 247

def views
  @views
end

#widthObject

Returns the value of attribute width.



244
245
246
# File 'lib/imgur.rb', line 244

def width
  @width
end