Class: Imgur::Client::Account

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

Instance Method Summary collapse

Methods inherited from Model

assoc_accessor, assoc_reader, assoc_writer

Instance Method Details

#albumsObject



22
23
24
25
26
# File 'lib/imgur/models/account.rb', line 22

def albums
  path = "/account/me/albums"
  data = connection.get_albums(path: path).body["data"]
  connection.albums.load(data)
end

#imagesObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/imgur/models/account.rb', line 9

def images
  data = []
  image_array = []
  page = 0
  until data.count > 0 && data.count != 50
    path = "/account/me/images/#{page}"
    data = connection.get_images(path: path).body["data"]
    data.each { |i| image_array << i }
    page += 1
  end
  connection.images.load(image_array)
end