ruby_ami 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # develop
2
2
 
3
+ # 0.1.2
4
+ * Bugfix: Prevent stream connection status events being passed up to the consumer event handler
5
+ * Bugfix: Corrected the README usage docs
6
+ * Bugfix: Alias Logger#trace to Logger#debug if the consumer is using a simple logger without a trace level
7
+
3
8
  # 0.1.1
4
9
  * Bugfix: Make countdownlatch and i18n runtime dependencies
5
10
  * Bugfig: Include the generated lexer file in the gem
data/README.md CHANGED
@@ -8,26 +8,23 @@ RubyAMI is an AMI client library in Ruby and based on EventMachine with the sole
8
8
  ```ruby
9
9
  require 'ruby_ami'
10
10
 
11
- class MyAMIClient < RubyAMI::Client
12
- def on_connect
13
- puts "AMI Connected successfully"
14
- write_action "Originate", ...some options...
15
- end
16
-
17
- def handle_event(event)
18
- puts "Received an AMI event: #{event}"
19
- end
20
-
21
- def handle_error(error)
22
- ...similar here...
23
- end
24
-
25
- def handle_response(response)
26
- ...similar here...
11
+ include RubyAMI
12
+
13
+ client = Client.new :username => 'test',
14
+ :password => 'test',
15
+ :host => '127.0.0.1',
16
+ :port => 5038,
17
+ :event_handler => lambda { |e| handle_event e },
18
+ :logger => Logger.new('ruby_ami.log')
19
+
20
+ def handle_event(event)
21
+ case event.name
22
+ when 'FullyBooted'
23
+ client.send_action 'Originate', 'Channel' => 'SIP/foo'
27
24
  end
28
25
  end
29
26
 
30
- EM.run { MyAMIClient.run '127.0.0.1', 5038, 'admin', 'password' }
27
+ client.start
31
28
  ```
32
29
 
33
30
  ## Links:
@@ -90,12 +90,13 @@ module RubyAMI
90
90
 
91
91
  def handle_event(event)
92
92
  logger.trace "[RECV-EVENTS]: #{event.inspect}" if logger
93
- pass_event event
94
93
  case event
95
94
  when Stream::Connected
96
95
  login_events
97
96
  when Stream::Disconnected
98
97
  unbind
98
+ else
99
+ pass_event event
99
100
  end
100
101
  end
101
102
 
@@ -1,3 +1,3 @@
1
1
  module RubyAMI
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/ruby_ami.rb CHANGED
@@ -15,6 +15,10 @@
15
15
  ruby_ami/metaprogramming
16
16
  }.each { |f| require f }
17
17
 
18
+ class Logger
19
+ alias :trace :debug
20
+ end
21
+
18
22
  module RubyAMI
19
23
  extend ActiveSupport::Autoload
20
24
 
@@ -84,6 +84,8 @@ module RubyAMI
84
84
  end
85
85
 
86
86
  subject.handle_event Stream::Connected.new
87
+
88
+ event_handler.should be_empty
87
89
  end
88
90
  end
89
91
  end
@@ -92,6 +94,7 @@ module RubyAMI
92
94
  it 'should unbind' do
93
95
  subject.expects(:unbind).once
94
96
  subject.handle_event Stream::Disconnected.new
97
+ event_handler.should be_empty
95
98
  end
96
99
  end
97
100
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_ami
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &2164856540 !ruby/object:Gem::Requirement
16
+ requirement: &2168838980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.0.9
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164856540
24
+ version_requirements: *2168838980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: uuidtools
27
- requirement: &2164855280 !ruby/object:Gem::Requirement
27
+ requirement: &2168838460 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2164855280
35
+ version_requirements: *2168838460
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: eventmachine
38
- requirement: &2164854540 !ruby/object:Gem::Requirement
38
+ requirement: &2168837740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *2164854540
46
+ version_requirements: *2168837740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: future-resource
49
- requirement: &2164853780 !ruby/object:Gem::Requirement
49
+ requirement: &2168837020 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *2164853780
57
+ version_requirements: *2168837020
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: girl_friday
60
- requirement: &2164852500 !ruby/object:Gem::Requirement
60
+ requirement: &2168836320 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *2164852500
68
+ version_requirements: *2168836320
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: countdownlatch
71
- requirement: &2164852020 !ruby/object:Gem::Requirement
71
+ requirement: &2168835000 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 1.0.0
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *2164852020
79
+ version_requirements: *2168835000
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: i18n
82
- requirement: &2164851500 !ruby/object:Gem::Requirement
82
+ requirement: &2168833400 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *2164851500
90
+ version_requirements: *2168833400
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: bundler
93
- requirement: &2164850980 !ruby/object:Gem::Requirement
93
+ requirement: &2168832740 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 1.0.0
99
99
  type: :development
100
100
  prerelease: false
101
- version_requirements: *2164850980
101
+ version_requirements: *2168832740
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: rspec
104
- requirement: &2164850420 !ruby/object:Gem::Requirement
104
+ requirement: &2168831600 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 2.5.0
110
110
  type: :development
111
111
  prerelease: false
112
- version_requirements: *2164850420
112
+ version_requirements: *2168831600
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: cucumber
115
- requirement: &2164849900 !ruby/object:Gem::Requirement
115
+ requirement: &2168813300 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '0'
121
121
  type: :development
122
122
  prerelease: false
123
- version_requirements: *2164849900
123
+ version_requirements: *2168813300
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: ci_reporter
126
- requirement: &2164849400 !ruby/object:Gem::Requirement
126
+ requirement: &2168812140 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: 1.6.3
132
132
  type: :development
133
133
  prerelease: false
134
- version_requirements: *2164849400
134
+ version_requirements: *2168812140
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: yard
137
- requirement: &2164848720 !ruby/object:Gem::Requirement
137
+ requirement: &2168810900 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: 0.6.0
143
143
  type: :development
144
144
  prerelease: false
145
- version_requirements: *2164848720
145
+ version_requirements: *2168810900
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: rcov
148
- requirement: &2164848020 !ruby/object:Gem::Requirement
148
+ requirement: &2168809620 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *2164848020
156
+ version_requirements: *2168809620
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: rake
159
- requirement: &2164846940 !ruby/object:Gem::Requirement
159
+ requirement: &2168809100 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *2164846940
167
+ version_requirements: *2168809100
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: mocha
170
- requirement: &2164846340 !ruby/object:Gem::Requirement
170
+ requirement: &2168808600 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ! '>='
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: '0'
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *2164846340
178
+ version_requirements: *2168808600
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: simplecov
181
- requirement: &2164845360 !ruby/object:Gem::Requirement
181
+ requirement: &2168808100 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ! '>='
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: '0'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *2164845360
189
+ version_requirements: *2168808100
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: simplecov-rcov
192
- requirement: &2164844160 !ruby/object:Gem::Requirement
192
+ requirement: &2168807580 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ! '>='
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: '0'
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *2164844160
200
+ version_requirements: *2168807580
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: guard-rspec
203
- requirement: &2164843760 !ruby/object:Gem::Requirement
203
+ requirement: &2168807200 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - ! '>='
@@ -208,7 +208,7 @@ dependencies:
208
208
  version: '0'
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *2164843760
211
+ version_requirements: *2168807200
212
212
  description: A Ruby client library for the Asterisk Management Interface build on
213
213
  eventmachine.
214
214
  email: