esendex4soap 0.4.26 → 0.4.28

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -2,6 +2,7 @@ source "http://rubygems.org"
2
2
  gem 'jruby-openssl' if defined?(JRUBY_VERSION)
3
3
  gem 'savon', '~> 0.9.7'
4
4
  gem 'log4r'
5
+ gem 'rchardet'
5
6
  group :development do
6
7
  gem "shoulda", ">= 0"
7
8
  gem "bundler", "~> 1.0.0"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.26
1
+ 0.4.28
data/esendex4soap.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{esendex4soap}
8
- s.version = "0.4.26"
8
+ s.version = "0.4.28"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = [%q{Voip Scout}]
@@ -41,6 +41,7 @@ Gem::Specification.new do |s|
41
41
  s.add_runtime_dependency(%q<jruby-openssl>, [">= 0"])
42
42
  s.add_runtime_dependency(%q<savon>, ["~> 0.9.7"])
43
43
  s.add_runtime_dependency(%q<log4r>, [">= 0"])
44
+ s.add_runtime_dependency(%q<rchardet>, [">= 0"])
44
45
  s.add_development_dependency(%q<shoulda>, [">= 0"])
45
46
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
46
47
  s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
@@ -49,6 +50,7 @@ Gem::Specification.new do |s|
49
50
  s.add_dependency(%q<jruby-openssl>, [">= 0"])
50
51
  s.add_dependency(%q<savon>, ["~> 0.9.7"])
51
52
  s.add_dependency(%q<log4r>, [">= 0"])
53
+ s.add_dependency(%q<rchardet>, [">= 0"])
52
54
  s.add_dependency(%q<shoulda>, [">= 0"])
53
55
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
56
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
@@ -58,6 +60,7 @@ Gem::Specification.new do |s|
58
60
  s.add_dependency(%q<jruby-openssl>, [">= 0"])
59
61
  s.add_dependency(%q<savon>, ["~> 0.9.7"])
60
62
  s.add_dependency(%q<log4r>, [">= 0"])
63
+ s.add_dependency(%q<rchardet>, [">= 0"])
61
64
  s.add_dependency(%q<shoulda>, [">= 0"])
62
65
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
63
66
  s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
data/lib/esendex4soap.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'savon'
3
3
  require 'log4r'
4
+ require 'rchardet'
4
5
 
5
6
  module Esendex
6
7
  class Client
@@ -36,18 +37,20 @@ module Esendex
36
37
  text = text.lstrip.rstrip
37
38
  @log.debug "TO:#{recipient} text size:#{text.size}"
38
39
 
39
- if text.scan(/./mu).size == text.size
40
+ if CharDet.detect(text)['encoding'] == 'ascii'
40
41
  sms_parts = text.scan(/.{610}/mu)
41
42
  sms_parts << text[sms_parts.to_s.size..text.size]
42
43
  @message_kind = 'Text'
43
44
  @log.debug "#{@message_kind}:#{text.scan(/./mu)} = #{text.size}. #{sms_parts.size} part/s."
44
45
  sms(recipient, sms_parts)
45
- else
46
+ elsif CharDet.detect(text)['encoding'] == 'utf-8'
46
47
  sms_parts = text.scan(/.{70}/mu)
47
48
  sms_parts << text[sms_parts.to_s.size..text.size]
48
49
  @message_kind = 'Unicode'
49
50
  @log.debug "#{@message_kind}:#{text.scan(/./mu)} != #{text.size}. #{sms_parts.size} part/s."
50
51
  sms(recipient, sms_parts)
52
+ else
53
+ @log.debug "Unsupported encoding: #{CharDet.detect(text)['encoding']}"
51
54
  end
52
55
  end
53
56
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: esendex4soap
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.4.26
5
+ version: 0.4.28
6
6
  platform: ruby
7
7
  authors:
8
8
  - Voip Scout
@@ -46,7 +46,7 @@ dependencies:
46
46
  prerelease: false
47
47
  type: :runtime
48
48
  - !ruby/object:Gem::Dependency
49
- name: shoulda
49
+ name: rchardet
50
50
  version_requirements: &id004 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
@@ -55,38 +55,49 @@ dependencies:
55
55
  version: "0"
56
56
  requirement: *id004
57
57
  prerelease: false
58
+ type: :runtime
59
+ - !ruby/object:Gem::Dependency
60
+ name: shoulda
61
+ version_requirements: &id005 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: "0"
67
+ requirement: *id005
68
+ prerelease: false
58
69
  type: :development
59
70
  - !ruby/object:Gem::Dependency
60
71
  name: bundler
61
- version_requirements: &id005 !ruby/object:Gem::Requirement
72
+ version_requirements: &id006 !ruby/object:Gem::Requirement
62
73
  none: false
63
74
  requirements:
64
75
  - - ~>
65
76
  - !ruby/object:Gem::Version
66
77
  version: 1.0.0
67
- requirement: *id005
78
+ requirement: *id006
68
79
  prerelease: false
69
80
  type: :development
70
81
  - !ruby/object:Gem::Dependency
71
82
  name: jeweler
72
- version_requirements: &id006 !ruby/object:Gem::Requirement
83
+ version_requirements: &id007 !ruby/object:Gem::Requirement
73
84
  none: false
74
85
  requirements:
75
86
  - - ~>
76
87
  - !ruby/object:Gem::Version
77
88
  version: 1.6.4
78
- requirement: *id006
89
+ requirement: *id007
79
90
  prerelease: false
80
91
  type: :development
81
92
  - !ruby/object:Gem::Dependency
82
93
  name: rcov
83
- version_requirements: &id007 !ruby/object:Gem::Requirement
94
+ version_requirements: &id008 !ruby/object:Gem::Requirement
84
95
  none: false
85
96
  requirements:
86
97
  - - ">="
87
98
  - !ruby/object:Gem::Version
88
99
  version: "0"
89
- requirement: *id007
100
+ requirement: *id008
90
101
  prerelease: false
91
102
  type: :development
92
103
  description: thanks to savon library