jpmobile 0.1.6 → 1.0.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/README +0 -0
- data/README.rdoc +58 -29
- data/Rakefile +1 -1
- data/VERSION.yml +4 -4
- data/lib/jpmobile.rb +3 -0
- data/lib/jpmobile/email.rb +17 -2
- data/lib/jpmobile/emoticon.rb +87 -23
- data/lib/jpmobile/emoticon/au.rb +644 -0
- data/lib/jpmobile/emoticon/softbank.rb +488 -0
- data/lib/jpmobile/emoticon/z_combine.rb +16 -13
- data/lib/jpmobile/hook_action_controller.rb +1 -13
- data/lib/jpmobile/hook_action_view.rb +3 -62
- data/lib/jpmobile/mail.rb +316 -0
- data/lib/jpmobile/mailer.rb +31 -0
- data/lib/jpmobile/mobile/abstract_mobile.rb +66 -0
- data/lib/jpmobile/mobile/au.rb +25 -2
- data/lib/jpmobile/mobile/docomo.rb +23 -1
- data/lib/jpmobile/mobile/emobile.rb +1 -1
- data/lib/jpmobile/mobile/softbank.rb +33 -1
- data/lib/jpmobile/mobile/vodafone.rb +1 -1
- data/lib/jpmobile/mobile/willcom.rb +1 -1
- data/lib/jpmobile/path_set.rb +40 -0
- data/lib/jpmobile/rails.rb +24 -0
- data/lib/jpmobile/resolver.rb +38 -0
- data/lib/jpmobile/util.rb +223 -14
- data/lib/tasks/jpmobile_tasks.rake +41 -48
- data/spec/rack/jpmobile/emoticon_spec.rb +3 -8
- data/spec/rack/jpmobile/filter_spec.rb +1 -1
- data/spec/rack/jpmobile/params_filter_spec.rb +4 -4
- data/spec/rack_helper.rb +5 -9
- data/spec/unit/detect_by_email_spec.rb +29 -0
- data/spec/unit/emoticon_spec.rb +90 -0
- data/spec/unit/encoding_spec.rb +102 -0
- data/spec/unit/mail_spec.rb +117 -0
- data/spec/unit/receive_mail_spec.rb +289 -0
- data/spec/unit/spec_helper.rb +8 -0
- data/spec/unit/util_spec.rb +5 -0
- data/test/rails/overrides/app/controllers/application_controller.rb +3 -2
- data/test/rails/overrides/app/controllers/template_path_controller.rb +8 -0
- data/test/rails/overrides/app/models/mobile_mailer.rb +19 -0
- data/test/rails/overrides/app/models/normal_mailer.rb +9 -0
- data/test/rails/overrides/spec/models/mobile_mailer_spec.rb +737 -0
- data/test/rails/overrides/spec/models/normal_mailer_spec.rb +34 -0
- data/test/rails/overrides/spec/requests/template_path_spec.rb +13 -7
- data/test/rails/overrides/spec/spec_helper.rb +6 -0
- data/test/rails/rails_root/app/controllers/application_controller.rb +3 -2
- data/test/rails/rails_root/app/controllers/template_path_controller.rb +8 -0
- data/test/rails/rails_root/app/models/mobile_mailer.rb +2 -1
- data/test/rails/rails_root/app/models/normal_mailer.rb +9 -0
- data/test/rails/rails_root/config/initializers/secret_token.rb +1 -1
- data/test/rails/rails_root/spec/models/mobile_mailer_spec.rb +73 -80
- data/test/rails/rails_root/spec/models/normal_mailer_spec.rb +34 -0
- data/test/rails/rails_root/spec/requests/template_path_spec.rb +13 -7
- data/test/rails/rails_root/spec/spec_helper.rb +1 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb +2 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +7 -5
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +1 -13
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +3 -62
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mail.rb +162 -111
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mailer.rb +31 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb +34 -3
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +2 -5
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb +4 -5
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +7 -8
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/path_set.rb +40 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/params_filter.rb +1 -1
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rails.rb +24 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/resolver.rb +38 -0
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb +33 -23
- metadata +43 -14
- data/test/legacy/emoticon_test.rb +0 -63
- data/test/legacy/helper.rb +0 -8
- data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_mailer.rb +0 -22
@@ -1,63 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
2
|
-
|
3
|
-
include Jpmobile::Util
|
4
|
-
|
5
|
-
class DocomoEmoticonTest < Test::Unit::TestCase
|
6
|
-
def test_external_unicodecr_docomo
|
7
|
-
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_docomo(sjis("\xf8\x9f"))
|
8
|
-
end
|
9
|
-
def test_unicodecr_external_docomo
|
10
|
-
assert_equal sjis("\xf8\x9f"), Jpmobile::Emoticon::unicodecr_to_external("")
|
11
|
-
end
|
12
|
-
def test_unicodecr_external_docomo_for_string
|
13
|
-
assert_equal sjis("\xf8\x9f\xf8\xa0"), Jpmobile::Emoticon::unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_DOCOMO, true)
|
14
|
-
end
|
15
|
-
def test_unicodecr_utf8_docomo
|
16
|
-
assert_equal utf8("\356\230\276"), Jpmobile::Emoticon::unicodecr_to_utf8("")
|
17
|
-
end
|
18
|
-
def test_utf8_unicodecr_docomo
|
19
|
-
assert_equal "", Jpmobile::Emoticon::utf8_to_unicodecr(utf8("\356\230\276"))
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class AuEmoticonTest < Test::Unit::TestCase
|
24
|
-
def test_au_external_unicodecr
|
25
|
-
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_au(sjis("\xf6\x59"))
|
26
|
-
end
|
27
|
-
def test_au_unicodecr_external
|
28
|
-
assert_equal sjis("\xf6\x59"), Jpmobile::Emoticon::unicodecr_to_external("")
|
29
|
-
end
|
30
|
-
def test_au_unicodecr_utf8
|
31
|
-
assert_equal utf8("\356\222\201"), Jpmobile::Emoticon::unicodecr_to_utf8("")
|
32
|
-
end
|
33
|
-
def test_au_utf8_unicodecr
|
34
|
-
assert_equal "", Jpmobile::Emoticon::utf8_to_unicodecr(utf8("\356\222\201"))
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class SoftbankEmoticonTest < Test::Unit::TestCase
|
39
|
-
def test_softbank_cr
|
40
|
-
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_softbank([0xe001].pack('U'))
|
41
|
-
end
|
42
|
-
def test_vodafone_cr
|
43
|
-
assert_equal "", Jpmobile::Emoticon::external_to_unicodecr_softbank([0xe001].pack('U'))
|
44
|
-
end
|
45
|
-
def test_softbank_cr_webcode
|
46
|
-
assert_equal [0xe001].pack('U'), Jpmobile::Emoticon::unicodecr_to_external("")
|
47
|
-
end
|
48
|
-
def test_softbank_cr_utf8
|
49
|
-
assert_equal utf8("\xef\x80\x81"), Jpmobile::Emoticon::unicodecr_to_utf8("")
|
50
|
-
end
|
51
|
-
def test_softbank_utf8_cr
|
52
|
-
assert_equal "", Jpmobile::Emoticon::utf8_to_unicodecr(utf8("\xef\x80\x81"))
|
53
|
-
end
|
54
|
-
def test_unicodecr_external_softbank_for_string
|
55
|
-
assert_equal [0xe04a, 0xe049].pack('U*'), Jpmobile::Emoticon::unicodecr_to_external("", Jpmobile::Emoticon::CONVERSION_TABLE_TO_SOFTBANK, true)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class KoukaiEmoticonTest < Test::Unit::TestCase
|
60
|
-
def test_koukai_sjis
|
61
|
-
assert_equal sjis("\x8c\xf6\x8a\x4a"), Jpmobile::Emoticon::external_to_unicodecr_docomo(sjis("\x8c\xf6\x8a\x4a"))
|
62
|
-
end
|
63
|
-
end
|
data/test/legacy/helper.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
require 'jpmobile/mail'
|
3
|
-
|
4
|
-
module Jpmobile
|
5
|
-
module Mailer
|
6
|
-
class Base < ActionMailer::Base
|
7
|
-
def mail(headers={}, &block)
|
8
|
-
m = super(headers, &block)
|
9
|
-
|
10
|
-
if m.to.size == 1
|
11
|
-
# for mobile
|
12
|
-
m.mobile = (Jpmobile::Email.detect(m.to.first) || Jpmobile::Mobile::AbstractMobile).new(nil, nil)
|
13
|
-
else
|
14
|
-
# for multi to addresses
|
15
|
-
m.mobile = Jpmobile::Mobile::AbstractMobile.new(nil, nil)
|
16
|
-
end
|
17
|
-
|
18
|
-
m
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|