Class: PogoPlug::FileListing

Inherits:
Object
  • Object
show all
Includes:
HashInitializer
Defined in:
lib/pogoplug/file_listing.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HashInitializer

#initialize

Instance Attribute Details

#filesObject

Returns the value of attribute files.



5
6
7
# File 'lib/pogoplug/file_listing.rb', line 5

def files
  @files
end

#offsetObject

Returns the value of attribute offset.



5
6
7
# File 'lib/pogoplug/file_listing.rb', line 5

def offset
  @offset
end

#sizeObject

Returns the value of attribute size.



5
6
7
# File 'lib/pogoplug/file_listing.rb', line 5

def size
  @size
end

#total_countObject

Returns the value of attribute total_count.



5
6
7
# File 'lib/pogoplug/file_listing.rb', line 5

def total_count
  @total_count
end

Class Method Details

.from_json(json) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/pogoplug/file_listing.rb', line 15

def self.from_json(json)
  listing = FileListing.new(
    size: json['count'].to_i,
    offset: json['pageoffset'].to_i,
    total_count: json['totalcount'].to_i
  )
  json['files'].each do |f|
    listing.files << File.from_json(f)
  end
  listing
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/pogoplug/file_listing.rb', line 11

def empty?
  @files.empty?
end