class Flickrie::User::UploadStatus

Public Class Methods

new(hash) click to toggle source
# File lib/flickrie/objects/user/upload_status.rb, line 26
def initialize(hash)
  raise ArgumentError if hash.nil?
  @hash = hash
end

Public Instance Methods

bandwidth() click to toggle source

Returns the monthly bandwidth. Example:

user.bandwidth.maximum    # => 300
user.bandwidth.used       # => 120
user.bandwidth.remaining  # => 180
user.bandwidth.unlimited? # => false

All numbers are in megabytes

@return [Class]

# File lib/flickrie/objects/user/upload_status.rb, line 18
def bandwidth
  bandwidth = Class.new do
    def maximum()   @hash['maxkb'].to_f / 1024       end
    def used()      @hash['usedkb'].to_f / 1024      end
    def remaining() @hash['remainingkb'].to_f / 1024 end

    def unlimited?()  @hash['unlimited'].to_i == 1 end

    def initialize(hash)
      raise ArgumentError if hash.nil?
      @hash = hash
    end
  end

  bandwidth.new(@hash['bandwidth']) rescue nil
end
maximum() click to toggle source
# File lib/flickrie/objects/user/upload_status.rb, line 20
def maximum()   @hash['maxkb'].to_f / 1024       end
maximum_photo_size() click to toggle source

@return [Fixnum] In megabytes

# File lib/flickrie/objects/user/upload_status.rb, line 36
def maximum_photo_size() Integer(@hash['filesize']['maxmb'])   rescue nil end
# @return [Fixnum] In megabytes
def maximum_video_size() Integer(@hash['videosize']['maxmb'])  rescue nil end
# @return [Fixnum]
def videos_uploaded()    Integer(@hash['videos']['uploaded'])  rescue nil end
# @return [Fixnum]
def videos_remaining()   Integer(@hash['videos']['remaining']) rescue nil end
# @return [Fixnum]
def sets_created()       Integer(@hash['sets']['created'])     rescue nil end
# @return [Fixnum, String]
def sets_remaining()     @hash['sets']['remaining']            rescue nil end

def initialize(hash)
  raise ArgumentError if hash.nil?
  @hash = hash
end
    
maximum_video_size() click to toggle source

@return [Fixnum] In megabytes

# File lib/flickrie/objects/user/upload_status.rb, line 38
  def maximum_video_size() Integer(@hash['videosize']['maxmb'])  rescue nil end
  # @return [Fixnum]
  def videos_uploaded()    Integer(@hash['videos']['uploaded'])  rescue nil end
  # @return [Fixnum]
  def videos_remaining()   Integer(@hash['videos']['remaining']) rescue nil end
  # @return [Fixnum]
  def sets_created()       Integer(@hash['sets']['created'])     rescue nil end
  # @return [Fixnum, String]
  def sets_remaining()     @hash['sets']['remaining']            rescue nil end

  def initialize(hash)
    raise ArgumentError if hash.nil?
    @hash = hash
  end
end
remaining() click to toggle source
# File lib/flickrie/objects/user/upload_status.rb, line 22
def remaining() @hash['remainingkb'].to_f / 1024 end
sets_created() click to toggle source

@return [Fixnum]

# File lib/flickrie/objects/user/upload_status.rb, line 44
    def sets_created()       Integer(@hash['sets']['created'])     rescue nil end
    # @return [Fixnum, String]
    def sets_remaining()     @hash['sets']['remaining']            rescue nil end

    def initialize(hash)
      raise ArgumentError if hash.nil?
      @hash = hash
    end
  end
end
sets_remaining() click to toggle source

@return [Fixnum, String]

# File lib/flickrie/objects/user/upload_status.rb, line 46
  def sets_remaining()     @hash['sets']['remaining']            rescue nil end

  def initialize(hash)
    raise ArgumentError if hash.nil?
    @hash = hash
  end
end
unlimited?() click to toggle source
# File lib/flickrie/objects/user/upload_status.rb, line 24
def unlimited?()  @hash['unlimited'].to_i == 1 end
used() click to toggle source
# File lib/flickrie/objects/user/upload_status.rb, line 21
def used()      @hash['usedkb'].to_f / 1024      end
videos_remaining() click to toggle source

@return [Fixnum]

# File lib/flickrie/objects/user/upload_status.rb, line 42
      def videos_remaining()   Integer(@hash['videos']['remaining']) rescue nil end
      # @return [Fixnum]
      def sets_created()       Integer(@hash['sets']['created'])     rescue nil end
      # @return [Fixnum, String]
      def sets_remaining()     @hash['sets']['remaining']            rescue nil end

      def initialize(hash)
        raise ArgumentError if hash.nil?
        @hash = hash
      end
    end
  end
end
videos_uploaded() click to toggle source

@return [Fixnum]

# File lib/flickrie/objects/user/upload_status.rb, line 40
    def videos_uploaded()    Integer(@hash['videos']['uploaded'])  rescue nil end
    # @return [Fixnum]
    def videos_remaining()   Integer(@hash['videos']['remaining']) rescue nil end
    # @return [Fixnum]
    def sets_created()       Integer(@hash['sets']['created'])     rescue nil end
    # @return [Fixnum, String]
    def sets_remaining()     @hash['sets']['remaining']            rescue nil end

    def initialize(hash)
      raise ArgumentError if hash.nil?
      @hash = hash
    end
  end
end