class Uploadcare::Api::FileList

Attributes

files[RW]
page[RW]
pages[RW]
per_page[RW]
total[RW]

Public Class Methods

new(api, response) click to toggle source
# File lib/uploadcare/api/file_list.rb, line 5
def initialize api, response
  @api = api
  @files = response['results'].map{ |obj| Api::File.new(api, obj) }
  @page = response['page'].to_i
  @per_page = response['per_page'].to_i
  @total = response['total'].to_i
  @pages = response['pages'].to_i
end

Public Instance Methods

[](index) click to toggle source

we need to get rid of @api.files.files[] for now on we will proxy the [] method down to the actual files collection.

# File lib/uploadcare/api/file_list.rb, line 16
def [] index
  @files[index]
end
to_a() click to toggle source

we already have files array, now we just have to return it back to user.

# File lib/uploadcare/api/file_list.rb, line 21
def to_a
  @files
end