freeswitcher 0.7.0 → 0.7.1

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.
@@ -12,8 +12,9 @@ module FSR
12
12
  end
13
13
  end
14
14
 
15
- def initialize(fs_socket = nil, type = nil)
15
+ def initialize(fs_socket = nil, type = nil, filter = nil)
16
16
  @type = type
17
+ @filter = filter
17
18
  unless @type.nil?
18
19
  raise ArgumentError, "Only #{TYPES} are allowed as arguments" unless TYPES.include?(@type)
19
20
  end
@@ -37,11 +38,16 @@ module FSR
37
38
 
38
39
  # This method builds the API command to send to the freeswitch event socket
39
40
  def raw
40
- if @type.nil?
41
+ base = if @type.nil?
41
42
  "show calls"
42
43
  else
43
44
  "show %s_calls" % @type
44
45
  end
46
+ if @filter
47
+ "%s like '%s'" % [base, @filter]
48
+ else
49
+ base
50
+ end
45
51
  end
46
52
  end
47
53
 
@@ -1,3 +1,3 @@
1
1
  module FSR
2
- VERSION = "0.7.0"
2
+ VERSION = "0.7.1"
3
3
  end
@@ -29,4 +29,9 @@ describe "Testing FSR::Cmd::Calls" do
29
29
  lambda { FSR::Cmd::Calls.new(nil, :food) }.should.raise ArgumentError
30
30
  end
31
31
 
32
+ it "FSR::Cmd::Calls sends a filter, when supplied" do
33
+ cmd = FSR::Cmd::Calls.new(nil, nil, "1234")
34
+ cmd.raw.should == "show calls like '1234'"
35
+ end
36
+
32
37
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: freeswitcher
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.7.0
5
+ version: 0.7.1
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-12 00:00:00 -06:00
16
+ date: 2012-01-13 00:00:00 -06:00
17
17
  default_executable:
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency