Class: Throttle::Client

Inherits:
Object
  • Object
show all
Includes:
Bandwidth
Defined in:
lib/throttle/client.rb

Instance Method Summary collapse

Methods included from Bandwidth

#parse_bandwidth

Instance Method Details

#limit(bandwidth) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/throttle/client.rb', line 21

def limit(bandwidth)
  Pipe.reset
  
  options = {
    :id        => 1,
    :bandwidth => parse_bandwidth(bandwidth)
  }
        
  Pipe.new(options).set
  status
end

#resetObject



16
17
18
19
# File 'lib/throttle/client.rb', line 16

def reset
  Pipe.reset
  status
end

#statusObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/throttle/client.rb', line 5

def status
  pipes  = Pipe.all
  status = ""
  pipes.each do |p|
    status += "#{p.bandwidth}"
  end  
  
  status = "No Limits." if status.empty?
  return status
end