ruby_ami 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # [develop](https://github.com/adhearsion/ruby_ami)
2
2
 
3
+ # [1.2.4](https://github.com/adhearsion/ruby_ami/compare/v1.2.3...v1.2.4) - [2012-10-13](https://rubygems.org/gems/ruby_ami/versions/1.2.4)
4
+ * Bugfix: No longer suffer "invalid byte sequence" exceptions due to encoding mismatch. Thanks tboyko
5
+
3
6
  # [1.2.3](https://github.com/adhearsion/ruby_ami/compare/v1.2.2...v1.2.3) - [2012-09-20](https://rubygems.org/gems/ruby_ami/versions/1.2.3)
4
7
  * Streams now inherit the client's logger
5
8
 
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'cgi'
2
3
 
3
4
  module RubyAMI
@@ -1,10 +1,11 @@
1
+ # encoding: utf-8
1
2
  module RubyAMI
2
3
  class Client
3
4
  attr_reader :options, :action_queue, :events_stream, :actions_stream
4
5
 
5
6
  def initialize(options)
6
7
  @options = options
7
- @logger = options[:logger]
8
+ @logger = options[:logger] || Logger.new(STDOUT)
8
9
  @logger.level = options[:log_level] || Logger::DEBUG if @logger
9
10
  @event_handler = @options[:event_handler]
10
11
  @state = :stopped
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  module RubyAMI
2
3
  class Error < StandardError
3
4
  attr_accessor :message, :action
@@ -22,4 +23,4 @@ module RubyAMI
22
23
  "#<#{self.class} #{[:message, :headers].map { |c| "#{c}=#{self.__send__(c).inspect rescue nil}" }.compact * ', '}>"
23
24
  end
24
25
  end
25
- end # RubyAMI
26
+ end # RubyAMI
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'ruby_ami/response'
2
3
 
3
4
  module RubyAMI
@@ -1,5 +1,6 @@
1
1
 
2
2
  # line 1 "lib/ruby_ami/lexer.rl.rb"
3
+ # encoding: utf-8
3
4
  module RubyAMI
4
5
  class Lexer
5
6
 
@@ -27,20 +28,20 @@ module RubyAMI
27
28
  ]
28
29
 
29
30
 
30
- # line 68 "lib/ruby_ami/lexer.rl.rb"
31
+ # line 69 "lib/ruby_ami/lexer.rl.rb"
31
32
  ##
32
33
 
33
34
  attr_accessor :ami_version
34
35
 
35
36
  def initialize(delegate = nil)
36
37
  @delegate = delegate
37
- @data = ""
38
+ @data = ''.encode('ISO-8859-1', 'ISO-8859-1')
38
39
  @current_pointer = 0
39
40
  @ragel_stack = []
40
41
  @ami_version = 0.0
41
42
 
42
43
 
43
- # line 44 "lib/ruby_ami/lexer.rb"
44
+ # line 45 "lib/ruby_ami/lexer.rb"
44
45
  class << self
45
46
  attr_accessor :_ami_protocol_parser_actions
46
47
  private :_ami_protocol_parser_actions, :_ami_protocol_parser_actions=
@@ -857,7 +858,7 @@ end
857
858
  self.ami_protocol_parser_en_response_follows = 268;
858
859
 
859
860
 
860
- # line 861 "lib/ruby_ami/lexer.rb"
861
+ # line 862 "lib/ruby_ami/lexer.rb"
861
862
  begin
862
863
  @current_pointer ||= 0
863
864
  @data_ending_pointer ||= @data.length
@@ -868,7 +869,7 @@ begin
868
869
  @ragel_act = 0
869
870
  end
870
871
 
871
- # line 96 "lib/ruby_ami/lexer.rl.rb"
872
+ # line 97 "lib/ruby_ami/lexer.rl.rb"
872
873
  ##
873
874
  end
874
875
 
@@ -879,7 +880,7 @@ end
879
880
 
880
881
  def resume!
881
882
 
882
- # line 883 "lib/ruby_ami/lexer.rb"
883
+ # line 884 "lib/ruby_ami/lexer.rb"
883
884
  begin
884
885
  _klen, _trans, _keys, _acts, _nacts = nil
885
886
  _goto_level = 0
@@ -913,7 +914,7 @@ begin
913
914
  begin
914
915
  @token_start = @current_pointer
915
916
  end
916
- # line 917 "lib/ruby_ami/lexer.rb"
917
+ # line 918 "lib/ruby_ami/lexer.rb"
917
918
  end # from state action switch
918
919
  end
919
920
  if _trigger_goto
@@ -981,87 +982,87 @@ begin
981
982
  _acts += 1
982
983
  case _ami_protocol_parser_actions[_acts - 1]
983
984
  when 0 then
984
- # line 33 "lib/ruby_ami/lexer.rl.rb"
985
+ # line 34 "lib/ruby_ami/lexer.rl.rb"
985
986
  begin
986
987
  init_success end
987
988
  when 1 then
988
- # line 35 "lib/ruby_ami/lexer.rl.rb"
989
+ # line 36 "lib/ruby_ami/lexer.rl.rb"
989
990
  begin
990
991
  init_response_follows end
991
992
  when 2 then
992
- # line 37 "lib/ruby_ami/lexer.rl.rb"
993
+ # line 38 "lib/ruby_ami/lexer.rl.rb"
993
994
  begin
994
995
  init_error end
995
996
  when 3 then
996
- # line 39 "lib/ruby_ami/lexer.rl.rb"
997
+ # line 40 "lib/ruby_ami/lexer.rl.rb"
997
998
  begin
998
999
  message_received @current_message end
999
1000
  when 4 then
1000
- # line 40 "lib/ruby_ami/lexer.rl.rb"
1001
+ # line 41 "lib/ruby_ami/lexer.rl.rb"
1001
1002
  begin
1002
1003
  error_received @current_message end
1003
1004
  when 5 then
1004
- # line 42 "lib/ruby_ami/lexer.rl.rb"
1005
+ # line 43 "lib/ruby_ami/lexer.rl.rb"
1005
1006
  begin
1006
1007
  version_starts end
1007
1008
  when 6 then
1008
- # line 43 "lib/ruby_ami/lexer.rl.rb"
1009
+ # line 44 "lib/ruby_ami/lexer.rl.rb"
1009
1010
  begin
1010
1011
  version_stops end
1011
1012
  when 7 then
1012
- # line 45 "lib/ruby_ami/lexer.rl.rb"
1013
+ # line 46 "lib/ruby_ami/lexer.rl.rb"
1013
1014
  begin
1014
1015
  key_starts end
1015
1016
  when 8 then
1016
- # line 46 "lib/ruby_ami/lexer.rl.rb"
1017
+ # line 47 "lib/ruby_ami/lexer.rl.rb"
1017
1018
  begin
1018
1019
  key_stops end
1019
1020
  when 9 then
1020
- # line 48 "lib/ruby_ami/lexer.rl.rb"
1021
+ # line 49 "lib/ruby_ami/lexer.rl.rb"
1021
1022
  begin
1022
1023
  value_starts end
1023
1024
  when 10 then
1024
- # line 49 "lib/ruby_ami/lexer.rl.rb"
1025
+ # line 50 "lib/ruby_ami/lexer.rl.rb"
1025
1026
  begin
1026
1027
  value_stops end
1027
1028
  when 11 then
1028
- # line 51 "lib/ruby_ami/lexer.rl.rb"
1029
+ # line 52 "lib/ruby_ami/lexer.rl.rb"
1029
1030
  begin
1030
1031
  error_reason_starts end
1031
1032
  when 12 then
1032
- # line 52 "lib/ruby_ami/lexer.rl.rb"
1033
+ # line 53 "lib/ruby_ami/lexer.rl.rb"
1033
1034
  begin
1034
1035
  error_reason_stops end
1035
1036
  when 13 then
1036
- # line 54 "lib/ruby_ami/lexer.rl.rb"
1037
+ # line 55 "lib/ruby_ami/lexer.rl.rb"
1037
1038
  begin
1038
1039
  syntax_error_starts end
1039
1040
  when 14 then
1040
- # line 55 "lib/ruby_ami/lexer.rl.rb"
1041
+ # line 56 "lib/ruby_ami/lexer.rl.rb"
1041
1042
  begin
1042
1043
  syntax_error_stops end
1043
1044
  when 15 then
1044
- # line 57 "lib/ruby_ami/lexer.rl.rb"
1045
+ # line 58 "lib/ruby_ami/lexer.rl.rb"
1045
1046
  begin
1046
1047
  immediate_response_starts end
1047
1048
  when 16 then
1048
- # line 58 "lib/ruby_ami/lexer.rl.rb"
1049
+ # line 59 "lib/ruby_ami/lexer.rl.rb"
1049
1050
  begin
1050
1051
  immediate_response_stops end
1051
1052
  when 17 then
1052
- # line 60 "lib/ruby_ami/lexer.rl.rb"
1053
+ # line 61 "lib/ruby_ami/lexer.rl.rb"
1053
1054
  begin
1054
1055
  follows_text_starts end
1055
1056
  when 18 then
1056
- # line 61 "lib/ruby_ami/lexer.rl.rb"
1057
+ # line 62 "lib/ruby_ami/lexer.rl.rb"
1057
1058
  begin
1058
1059
  follows_text_stops end
1059
1060
  when 19 then
1060
- # line 63 "lib/ruby_ami/lexer.rl.rb"
1061
+ # line 64 "lib/ruby_ami/lexer.rl.rb"
1061
1062
  begin
1062
1063
  event_name_starts end
1063
1064
  when 20 then
1064
- # line 64 "lib/ruby_ami/lexer.rl.rb"
1065
+ # line 65 "lib/ruby_ami/lexer.rl.rb"
1065
1066
  begin
1066
1067
  event_name_stops end
1067
1068
  when 21 then
@@ -1385,7 +1386,7 @@ end
1385
1386
  end
1386
1387
  end
1387
1388
  end
1388
- # line 1389 "lib/ruby_ami/lexer.rb"
1389
+ # line 1390 "lib/ruby_ami/lexer.rb"
1389
1390
  end # action switch
1390
1391
  end
1391
1392
  end
@@ -1410,7 +1411,7 @@ when 29 then
1410
1411
  begin
1411
1412
  @ragel_act = 0
1412
1413
  end
1413
- # line 1414 "lib/ruby_ami/lexer.rb"
1414
+ # line 1415 "lib/ruby_ami/lexer.rb"
1414
1415
  end # to state action switch
1415
1416
  end
1416
1417
  if _trigger_goto
@@ -1441,7 +1442,7 @@ end
1441
1442
  end
1442
1443
  end
1443
1444
 
1444
- # line 105 "lib/ruby_ami/lexer.rl.rb"
1445
+ # line 106 "lib/ruby_ami/lexer.rl.rb"
1445
1446
  ##
1446
1447
  end
1447
1448
 
@@ -1464,7 +1465,7 @@ end
1464
1465
  @data.slice! 0...length
1465
1466
  adjust_pointers -length
1466
1467
  end
1467
- @data << new_data
1468
+ @data << new_data.encode('ISO-8859-1', 'ISO-8859-1')
1468
1469
  @data_ending_pointer = @data.size
1469
1470
  end
1470
1471
 
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  module RubyAMI
2
3
  class Lexer
3
4
 
@@ -71,7 +72,7 @@ module RubyAMI
71
72
 
72
73
  def initialize(delegate = nil)
73
74
  @delegate = delegate
74
- @data = ""
75
+ @data = ''.encode('ISO-8859-1', 'ISO-8859-1')
75
76
  @current_pointer = 0
76
77
  @ragel_stack = []
77
78
  @ami_version = 0.0
@@ -124,7 +125,7 @@ module RubyAMI
124
125
  @data.slice! 0...length
125
126
  adjust_pointers -length
126
127
  end
127
- @data << new_data
128
+ @data << new_data.encode('ISO-8859-1', 'ISO-8859-1')
128
129
  @data_ending_pointer = @data.size
129
130
  end
130
131
 
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  class Object
2
3
  def metaclass
3
4
  class << self
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  module RubyAMI
2
3
  ##
3
4
  # This is the object containing a response from Asterisk.
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  module RubyAMI
2
3
  class Stream
3
4
  class ConnectionStatus
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  module RubyAMI
2
- VERSION = "1.2.3"
3
+ VERSION = "1.2.4"
3
4
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module RubyAMI
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module RubyAMI
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module RubyAMI
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module RubyAMI
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module RubyAMI
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module RubyAMI
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module RubyAMI
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require 'spec_helper'
2
3
 
3
4
  module RubyAMI
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  begin
2
3
  require 'simplecov'
3
4
  require 'simplecov-rcov'
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  MockServer = Class.new
2
3
 
3
4
  class ServerMock
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: 1.2.3
4
+ version: 1.2.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-20 00:00:00.000000000 Z
12
+ date: 2012-10-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: celluloid-io
@@ -330,7 +330,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
330
330
  version: '0'
331
331
  segments:
332
332
  - 0
333
- hash: -814081533276479548
333
+ hash: -2097569653935330103
334
334
  required_rubygems_version: !ruby/object:Gem::Requirement
335
335
  none: false
336
336
  requirements:
@@ -339,7 +339,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
339
  version: '0'
340
340
  segments:
341
341
  - 0
342
- hash: -814081533276479548
342
+ hash: -2097569653935330103
343
343
  requirements: []
344
344
  rubyforge_project: ruby_ami
345
345
  rubygems_version: 1.8.23