freeswitcher 0.6.16 → 0.6.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/fsr/cmd/calls.rb CHANGED
@@ -4,6 +4,7 @@ module FSR
4
4
  class Calls < Command
5
5
 
6
6
  include Enumerable
7
+ TYPES = [:detailed, :bridged, :detailed_bridged]
7
8
  def each(&block)
8
9
  @calls ||= run
9
10
  if @calls
@@ -11,7 +12,11 @@ module FSR
11
12
  end
12
13
  end
13
14
 
14
- def initialize(fs_socket = nil)
15
+ def initialize(fs_socket = nil, type = nil)
16
+ @type = type
17
+ unless @type.nil?
18
+ raise ArgumentError, "Only #{TYPES} are allowed as arguments" unless TYPES.include?(@type)
19
+ end
15
20
  @fs_socket = fs_socket # FSR::CommandSocket obj
16
21
  end
17
22
 
@@ -32,7 +37,11 @@ module FSR
32
37
 
33
38
  # This method builds the API command to send to the freeswitch event socket
34
39
  def raw
35
- orig_command = "show calls"
40
+ if @type.nil?
41
+ "show calls"
42
+ else
43
+ "show %s_calls" % @type
44
+ end
36
45
  end
37
46
  end
38
47
 
data/lib/fsr/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module FSR
2
- VERSION = "0.6.16"
2
+ VERSION = "0.6.17"
3
3
  end
@@ -10,4 +10,23 @@ describe "Testing FSR::Cmd::Calls" do
10
10
  cmd.raw.should == "show calls"
11
11
  end
12
12
 
13
+ it "FSR::Cmd::Calls with the :detailed argument should send show detailed_calls" do
14
+ cmd = FSR::Cmd::Calls.new(nil, :detailed)
15
+ cmd.raw.should == "show detailed_calls"
16
+ end
17
+
18
+ it "FSR::Cmd::Calls with the :bridged argument should send show detailed_calls" do
19
+ cmd = FSR::Cmd::Calls.new(nil, :bridged)
20
+ cmd.raw.should == "show bridged_calls"
21
+ end
22
+
23
+ it "FSR::Cmd::Calls with the :detailed_bridged argument should send show detailed_calls" do
24
+ cmd = FSR::Cmd::Calls.new(nil, :detailed_bridged)
25
+ cmd.raw.should == "show detailed_bridged_calls"
26
+ end
27
+
28
+ it "FSR::Cmd::Calls fails with an invalid type argument" do
29
+ lambda { FSR::Cmd::Calls.new(nil, :food) }.should.raise ArgumentError
30
+ end
31
+
13
32
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: freeswitcher
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.6.16
5
+ version: 0.6.17
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jayson Vaughn
@@ -13,7 +13,7 @@ autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
15
 
16
- date: 2012-01-10 00:00:00 -06:00
16
+ date: 2012-01-11 00:00:00 -06:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency