ruby-asterisk 0.1.0 → 0.2.0

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.
@@ -2,105 +2,105 @@
2
2
  require 'spec_helper'
3
3
  describe RubyAsterisk do
4
4
 
5
- def mock_request(stubs={})
5
+ def mock_request(stubs={})
6
6
  (@mock_request ||= mock_model(RubyAsterisk::Request).as_null_object).tap do |request|
7
7
  request.stub(stubs) unless stubs.empty?
8
8
  end
9
9
  end
10
10
 
11
- before :each do
12
- @session = RubyAsterisk::AMI.new("127.0.0.1",5038)
11
+ before :each do
12
+ @session = RubyAsterisk::AMI.new("127.0.0.1",5038)
13
13
  end
14
14
 
15
- after :each do
16
- @session.disconnect
17
- end
15
+ after :each do
16
+ @session.disconnect
17
+ end
18
18
 
19
- describe ".new" do
20
- it "initialize session with host" do
21
- @session.host.should eq("127.0.0.1")
22
- end
19
+ describe ".new" do
20
+ it "initialize session with host" do
21
+ @session.host.should eq("127.0.0.1")
22
+ end
23
23
 
24
- it "initialize session with host" do
24
+ it "initialize session with host" do
25
25
  @session.port.should eq(5038)
26
26
  end
27
27
 
28
- it "should start the session as disconnected" do
29
- @session.connected.should_not be_true
30
- end
31
- end
28
+ it "should start the session as disconnected" do
29
+ @session.connected.should_not be_true
30
+ end
31
+ end
32
32
 
33
- describe ".connect" do
34
- it "should return true if everything is ok" do
35
- @session.connect.should be_true
36
- end
33
+ describe ".connect" do
34
+ it "should return true if everything is ok" do
35
+ @session.connect.should be_true
36
+ end
37
37
 
38
- it "should return false if everything if something went wrong" do
39
- @session.port = 666
38
+ it "should return false if everything if something went wrong" do
39
+ @session.port = 666
40
40
  @session.connect.should_not be_true
41
- @session.port = 5038
41
+ @session.port = 5038
42
42
  end
43
43
 
44
- it "should change state to session as connected" do
45
- @session.connect
46
- @session.connected.should be_true
47
- end
48
- end
44
+ it "should change state to session as connected" do
45
+ @session.connect
46
+ @session.connected.should be_true
47
+ end
48
+ end
49
49
 
50
- describe ".disconnect" do
50
+ describe ".disconnect" do
51
51
  it "should return true if everything is ok" do
52
52
  @session.disconnect.should be_true
53
53
  end
54
54
 
55
- it "should change state to session as disconnected" do
55
+ it "should change state to session as disconnected" do
56
56
  @session.disconnect
57
57
  @session.connected.should_not be_true
58
58
  end
59
59
  end
60
60
 
61
- describe ".login" do
62
- it "should return a response object" do
63
- @session.login("mark","mysecret").should be_kind_of(RubyAsterisk::Response)
64
- end
61
+ describe ".login" do
62
+ it "should return a response object" do
63
+ @session.login("mark","mysecret").should be_kind_of(RubyAsterisk::Response)
64
+ end
65
65
 
66
- it "should return a response with type Login" do
67
- @session.login("mark","mysecret").type.should eq("Login")
68
- end
66
+ it "should return a response with type Login" do
67
+ @session.login("mark","mysecret").type.should eq("Login")
68
+ end
69
69
 
70
- describe "if everything is ok" do
71
- it "should return a successfull response" do
72
- @session.login("mark","mysecret").success.should be_true
73
- end
70
+ describe "if everything is ok" do
71
+ it "should return a successfull response" do
72
+ @session.login("mark","mysecret").success.should be_true
73
+ end
74
74
 
75
- it "should fill the ActionID" do
75
+ it "should fill the ActionID" do
76
76
  @session.login("mark","mysecret").action_id.should_not be_nil
77
77
  end
78
78
 
79
- it "should fill the Message" do
79
+ it "should fill the Message" do
80
80
  @session.login("mark","mysecret").message.should_not be_nil
81
81
  end
82
- end
82
+ end
83
83
 
84
- describe "if credentials are wrong" do
85
- it "should not return a successfull response" do
86
- @session.login("mark","wrong").success.should be_false
87
- end
88
- end
89
- end
84
+ describe "if credentials are wrong" do
85
+ it "should not return a successfull response" do
86
+ @session.login("mark","wrong").success.should be_false
87
+ end
88
+ end
89
+ end
90
90
 
91
- describe ".core_show_channels" do
91
+ describe ".core_show_channels" do
92
92
  it "should return a response object" do
93
- @session.login("mark","mysecret")
93
+ @session.login("mark","mysecret")
94
94
  @session.core_show_channels.should be_kind_of(RubyAsterisk::Response)
95
95
  end
96
96
 
97
- it "should contain additional data about channels" do
98
- @session.login("mark","mysecret")
99
- @session.core_show_channels.data[:channels].should_not be_nil
100
- end
101
- end
97
+ it "should contain additional data about channels" do
98
+ @session.login("mark","mysecret")
99
+ @session.core_show_channels.data[:channels].should_not be_nil
100
+ end
101
+ end
102
102
 
103
- describe ".parked_calls" do
103
+ describe ".parked_calls" do
104
104
  it "should return a response object" do
105
105
  @session.login("mark","mysecret")
106
106
  @session.parked_calls.should be_kind_of(RubyAsterisk::Response)
@@ -112,28 +112,28 @@ describe RubyAsterisk do
112
112
  end
113
113
  end
114
114
 
115
- describe ".originate" do
116
- it "should return a response object" do
117
- @session.login("mark","mysecret")
118
- @session.originate("SIP/9100","OUTGOING","123456","1","queue=SIP/1000&SIP/1001").should be_kind_of(RubyAsterisk::Response)
119
- end
120
- end
115
+ describe ".originate" do
116
+ it "should return a response object" do
117
+ @session.login("mark","mysecret")
118
+ @session.originate("SIP/9100","OUTGOING","123456","1","queue=SIP/1000&SIP/1001").should be_kind_of(RubyAsterisk::Response)
119
+ end
120
+ end
121
121
 
122
- describe ".command" do
122
+ describe ".command" do
123
123
  it "should return a response object" do
124
124
  @session.login("mark","mysecret")
125
125
  @session.command("meetme list").should be_kind_of(RubyAsterisk::Response)
126
126
  end
127
127
  end
128
128
 
129
- describe ".meet_me_list" do
129
+ describe ".meet_me_list" do
130
130
  it "should return a response object" do
131
131
  @session.login("mark","mysecret")
132
132
  @session.meet_me_list.should be_kind_of(RubyAsterisk::Response)
133
133
  end
134
134
  end
135
135
 
136
- describe ".extension_state" do
136
+ describe ".extension_state" do
137
137
  it "should return a response object" do
138
138
  @session.login("mark","mysecret")
139
139
  @session.extension_state("9100","HINT").should be_kind_of(RubyAsterisk::Response)
@@ -147,4 +147,46 @@ describe RubyAsterisk do
147
147
  end
148
148
  end
149
149
 
150
+ describe ".wait_event" do
151
+ it "should return a response object" do
152
+ @session.login("mark","mysecret")
153
+ @session.wait_event(1).should be_kind_of(RubyAsterisk::Response)
154
+ end
155
+ end
156
+
157
+ describe ".monitor" do
158
+ it "should return a response object" do
159
+ @session.login("mark","mysecret")
160
+ @session.monitor("SIP/9100").should be_kind_of(RubyAsterisk::Response)
161
+ end
162
+ end
163
+
164
+ describe ".stop_monitor" do
165
+ it "should return a response object" do
166
+ @session.login("mark","mysecret")
167
+ @session.stop_monitor("SIP/9100").should be_kind_of(RubyAsterisk::Response)
168
+ end
169
+ end
170
+
171
+ describe ".pause_monitor" do
172
+ it "should return a response object" do
173
+ @session.login("mark","mysecret")
174
+ @session.pause_monitor("SIP/9100").should be_kind_of(RubyAsterisk::Response)
175
+ end
176
+ end
177
+
178
+ describe ".unpause_monitor" do
179
+ it "should return a response object" do
180
+ @session.login("mark","mysecret")
181
+ @session.unpause_monitor("SIP/9100").should be_kind_of(RubyAsterisk::Response)
182
+ end
183
+ end
184
+
185
+ describe ".change_monitor" do
186
+ it "should return a response object" do
187
+ @session.login("mark","mysecret")
188
+ @session.change_monitor("SIP/9100","first-sip-9100").should be_kind_of(RubyAsterisk::Response)
189
+ end
190
+ end
191
+
150
192
  end
@@ -1,3 +1,5 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
1
3
  require 'rubygems'
2
4
  require 'bundler'
3
5
 
metadata CHANGED
@@ -1,60 +1,91 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-asterisk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emiliano Della Casa
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-07 00:00:00.000000000 Z
11
+ date: 2019-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: simplecov
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: quality
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
41
69
  description: Add support to your ruby or rails projects to Asterisk Manager Interface
42
70
  (AMI)
43
71
  email:
44
- - e.dellacasa@engim.eu
72
+ - emiliano.dellacasa@gmail.com
45
73
  executables: []
46
74
  extensions: []
47
75
  extra_rdoc_files: []
48
76
  files:
49
- - .gitignore
50
- - .rspec
77
+ - ".gitignore"
78
+ - ".rspec"
51
79
  - CHANGELOG
52
80
  - Gemfile
81
+ - LICENCE
53
82
  - README.md
54
83
  - Rakefile
55
84
  - lib/ruby-asterisk.rb
85
+ - lib/ruby-asterisk/parsing_constants.rb
56
86
  - lib/ruby-asterisk/request.rb
57
87
  - lib/ruby-asterisk/response.rb
88
+ - lib/ruby-asterisk/response_parser.rb
58
89
  - lib/ruby-asterisk/version.rb
59
90
  - ruby-asterisk.gemspec
60
91
  - spec/ruby-asterisk/request_spec.rb
@@ -62,7 +93,8 @@ files:
62
93
  - spec/ruby-asterisk/ruby_asterisk_spec.rb
63
94
  - spec/spec_helper.rb
64
95
  homepage: http://github.com/emilianodellacasa/ruby-asterisk
65
- licenses: []
96
+ licenses:
97
+ - MIT
66
98
  metadata: {}
67
99
  post_install_message:
68
100
  rdoc_options: []
@@ -70,18 +102,22 @@ require_paths:
70
102
  - lib
71
103
  required_ruby_version: !ruby/object:Gem::Requirement
72
104
  requirements:
73
- - - '>='
105
+ - - ">="
74
106
  - !ruby/object:Gem::Version
75
107
  version: '0'
76
108
  required_rubygems_version: !ruby/object:Gem::Requirement
77
109
  requirements:
78
- - - '>='
110
+ - - ">="
79
111
  - !ruby/object:Gem::Version
80
112
  version: '0'
81
113
  requirements: []
82
114
  rubyforge_project: ruby-asterisk
83
- rubygems_version: 2.0.3
115
+ rubygems_version: 2.6.11
84
116
  signing_key:
85
117
  specification_version: 4
86
118
  summary: Asterisk Manager Interface in Ruby
87
- test_files: []
119
+ test_files:
120
+ - spec/ruby-asterisk/request_spec.rb
121
+ - spec/ruby-asterisk/response_spec.rb
122
+ - spec/ruby-asterisk/ruby_asterisk_spec.rb
123
+ - spec/spec_helper.rb