class Imgur::Album
Attributes
account_url[RW]
cover[RW]
cover_height[RW]
cover_width[RW]
date[RW]
deletehash[RW]
description[RW]
id[RW]
images[RW]
images_count[RW]
layout[RW]
link[RW]
privacy[RW]
title[RW]
views[RW]
Public Class Methods
new(data)
click to toggle source
# File lib/imgur.rb, line 169 def initialize(data) @id = data['id'] @title = data['title'] @description = data['description'] @date = Time.at data['datetime'] @cover = data['cover'] @cover_width = data['cover_width'] @account_url = data['account_url'] @privacy = data['privacy'] @layout = data['layout'] @views = data['views'] @link = data['link'] @deletehash = data['deletehash'] @images_count = data['images_count'] @images = [] data['images'].each do |img| @images << Image.new(img) end end
Public Instance Methods
update(client)
click to toggle source
# File lib/imgur.rb, line 189 def update(client) if @deletehash == nil raise UpdateException.new 'Album must have a deletehash to update' end url = API_PATH + ALBUM_GET_PATH + @deletehash image_ids = [] # Make sure we're only strings @images.each do |img| if img.is_a? Image image_ids << img.id elsif img.is_a? String image_ids << img end end body = { ids: @images, title: @title, description: @description, privacy: @privacy, layout: @layout, cover: @cover } puts body client.post(url, body: body) end