jpmobile 1.0.12 → 2.0.0.pre.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. data/Gemfile +3 -3
  2. data/README.rdoc +2 -14
  3. data/Rakefile +0 -1
  4. data/VERSION.yml +4 -4
  5. data/jpmobile.gemspec +2 -1
  6. data/lib/jpmobile.rb +1 -15
  7. data/lib/jpmobile/docomo_guid.rb +1 -1
  8. data/lib/jpmobile/emoticon.rb +3 -119
  9. data/lib/jpmobile/emoticon/z_combine.rb +1 -17
  10. data/lib/jpmobile/filter.rb +1 -6
  11. data/lib/jpmobile/helpers.rb +1 -1
  12. data/lib/jpmobile/mail.rb +27 -196
  13. data/lib/jpmobile/mailer.rb +1 -7
  14. data/lib/jpmobile/mobile/abstract_mobile.rb +36 -94
  15. data/lib/jpmobile/mobile/android.rb +0 -2
  16. data/lib/jpmobile/mobile/au.rb +0 -4
  17. data/lib/jpmobile/mobile/docomo.rb +0 -8
  18. data/lib/jpmobile/mobile/iphone.rb +15 -1
  19. data/lib/jpmobile/mobile/smart_phone.rb +0 -10
  20. data/lib/jpmobile/mobile/softbank.rb +0 -8
  21. data/lib/jpmobile/rack.rb +1 -6
  22. data/lib/jpmobile/rack/filter.rb +1 -7
  23. data/lib/jpmobile/rack/params_filter.rb +2 -2
  24. data/lib/jpmobile/rails.rb +1 -1
  25. data/lib/jpmobile/resolver.rb +2 -5
  26. data/lib/jpmobile/trans_sid.rb +1 -26
  27. data/lib/jpmobile/util.rb +11 -82
  28. data/lib/tasks/jpmobile_tasks.rake +1 -1
  29. data/spec/rack/jpmobile/emoticon_spec.rb +0 -223
  30. data/spec/rack/jpmobile/mobile_by_ua_spec.rb +1 -5
  31. data/spec/rack/jpmobile/softbank_spec.rb +1 -1
  32. data/spec/unit/emoticon_spec.rb +0 -64
  33. data/spec/unit/encoding_spec.rb +2 -2
  34. data/spec/unit/mail_spec.rb +2 -159
  35. data/spec/unit/receive_mail_spec.rb +5 -51
  36. data/spec/unit/spec_helper.rb +1 -1
  37. data/spec/unit/util_spec.rb +3 -62
  38. data/test/rails/overrides/Gemfile +1 -1
  39. data/test/rails/overrides/app/controllers/filter_controller_base.rb +0 -3
  40. data/test/rails/overrides/app/controllers/hankaku_input_filter_controller.rb +0 -3
  41. data/test/rails/overrides/app/controllers/template_path_controller.rb +0 -12
  42. data/test/rails/overrides/app/{mailers → models}/mobile_mailer.rb +1 -7
  43. data/test/rails/overrides/app/{mailers → models}/normal_mailer.rb +0 -0
  44. data/test/rails/overrides/spec/{mailers → models}/mobile_mailer_spec.rb +1 -18
  45. data/test/rails/overrides/spec/{mailers → models}/normal_mailer_spec.rb +0 -0
  46. data/test/rails/overrides/spec/requests/filter_spec.rb +0 -18
  47. data/test/rails/overrides/spec/requests/template_path_spec.rb +0 -72
  48. data/test/rails/overrides/spec/spec_helper.rb +1 -1
  49. data/test/sinatra/guestbook.rb +7 -8
  50. data/test/sinatra/test/filter_test.rb +0 -10
  51. metadata +169 -296
  52. data/lib/jpmobile/emoticon/google.rb +0 -2421
  53. data/lib/jpmobile/emoticon/unicode.rb +0 -2253
  54. data/lib/jpmobile/mobile/android_tablet.rb +0 -12
  55. data/lib/jpmobile/mobile/black_berry.rb +0 -10
  56. data/lib/jpmobile/mobile/google_emoticon.rb +0 -29
  57. data/lib/jpmobile/mobile/ipad.rb +0 -12
  58. data/lib/jpmobile/mobile/tablet.rb +0 -16
  59. data/lib/jpmobile/mobile/unicode_emoticon.rb +0 -43
  60. data/lib/jpmobile/sinatra.rb +0 -16
  61. data/spec/rack/jpmobile/black_berry_spec.rb +0 -20
  62. data/spec/unit/decorated_mail_spec.rb +0 -76
  63. data/spec/unit/email-fixtures/bounce_with_utf8_part.eml +0 -42
  64. data/spec/unit/email-fixtures/iphone-mail3.eml +0 -56
  65. data/spec/unit/email-fixtures/iphone-message.eml +0 -27
  66. data/spec/unit/email-fixtures/photo.jpg +0 -0
  67. data/spec/unit/mobile/iphone_spec.rb +0 -34
  68. data/test/rails/overrides/app/mailers/decorated_mailer.rb +0 -11
  69. data/test/rails/overrides/app/views/decorated_mailer/deco_mail.html.erb +0 -10
  70. data/test/rails/overrides/app/views/decorated_mailer/deco_mail.text.erb +0 -1
  71. data/test/rails/overrides/app/views/hankaku_input_filter/with_charset.html.erb +0 -1
  72. data/test/rails/overrides/app/views/layouts/with_charset.html.erb +0 -13
  73. data/test/rails/overrides/app/views/template_path/smart_phone_only.html.erb +0 -1
  74. data/test/rails/overrides/app/views/template_path/smart_phone_only_smart_phone.html.erb +0 -1
  75. data/test/rails/overrides/app/views/template_path/with_ipd.html.erb +0 -1
  76. data/test/rails/overrides/app/views/template_path/with_ipd_tablet_ipad.html.erb +0 -1
  77. data/test/rails/overrides/app/views/template_path/with_tblt.html.erb +0 -1
  78. data/test/rails/overrides/app/views/template_path/with_tblt_tablet.html.erb +0 -1
  79. data/test/rails/overrides/spec/fixtures/mobile_mailer/bounced-jp.eml +0 -72
  80. data/test/rails/overrides/spec/fixtures/mobile_mailer/photo.jpg +0 -0
  81. data/test/rails/overrides/spec/mailers/decorated_mailer_spec.rb +0 -44
  82. data/test/sinatra/config.ru +0 -2
  83. data/test/sinatra/views/index.erb +0 -1
  84. data/test/sinatra/views/index_mobile.erb +0 -1
  85. data/tools/e4u_conv.rb +0 -122
@@ -1 +0,0 @@
1
- <%= link_to 'リンク', '#' -%>
@@ -1,13 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>RailsRoot</title>
5
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6
- <%= csrf_meta_tag %>
7
- </head>
8
- <body>
9
-
10
- <%= yield %>
11
-
12
- </body>
13
- </html>
@@ -1 +0,0 @@
1
- <h1>smart_phone_only.html.erb</h1>
@@ -1 +0,0 @@
1
- <h1>smart_phone_only_smart_phone.html.erb</h1>
@@ -1 +0,0 @@
1
- <h1>with_ipd.html.erb</h1>
@@ -1 +0,0 @@
1
- <h1>with_ipd_tablet_ipad.html.erb</h1>
@@ -1 +0,0 @@
1
- <h1>with_tblt.html.erb</h1>
@@ -1 +0,0 @@
1
- <h1>with_tblt_tablet.html.erb</h1>
@@ -1,72 +0,0 @@
1
- Return-Path: <>
2
- X-Original-To: info@example.jp
3
- Delivered-To: info@example.jp
4
- Received: by localhost (Postfix)
5
- id 081F8161D92; Fri, 17 Aug 2012 23:05:01 +0900 (JST)
6
- Date: Fri, 17 Aug 2012 23:05:01 +0900 (JST)
7
- From: MAILER-DAEMON@example.jp (Mail Delivery System)
8
- Subject: Undelivered Mail Returned to Sender
9
- To: info@example.jp
10
- Auto-Submitted: auto-replied
11
- MIME-Version: 1.0
12
- Content-Type: multipart/report; report-type=delivery-status;
13
- boundary="EAE03161D91.1345212301/localhost"
14
- Message-Id: <20120817140501.081F8161D92@localhost>
15
-
16
- This is a MIME-encapsulated message.
17
-
18
- --EAE03161D91.1345212301/localhost
19
- Content-Description: Notification
20
- Content-Type: text/plain; charset=us-ascii
21
-
22
- This is the mail system at host localhost.
23
-
24
- I'm sorry to have to inform you that your message could not
25
- be delivered to one or more recipients. It's attached below.
26
-
27
- For further assistance, please send mail to postmaster.
28
-
29
- If you do so, please include this problem report. You can
30
- delete your own text from the attached returned message.
31
-
32
- The mail system
33
-
34
- <unknown@docomo.ne.jp>: host mfsmax.docomo.ne.jp[203.138.181.112] said: 550
35
- Unknown user unknown@docomo.ne.jp (in reply to end of DATA command)
36
-
37
- --EAE03161D91.1345212301/localhost
38
- Content-Description: Delivery report
39
- Content-Type: message/delivery-status
40
-
41
- Reporting-MTA: dns; localhost
42
- X-Postfix-Queue-ID: EAE03161D91
43
- X-Postfix-Sender: rfc822; info@example.jp
44
- Arrival-Date: Fri, 17 Aug 2012 23:05:00 +0900 (JST)
45
-
46
- Final-Recipient: rfc822; unknown@docomo.ne.jp
47
- Action: failed
48
- Status: 5.0.0
49
- Remote-MTA: dns; mfsmax.docomo.ne.jp
50
- Diagnostic-Code: smtp; 550 Unknown user unknown@docomo.ne.jp
51
-
52
- --EAE03161D91.1345212301/localhost
53
- Content-Description: Undelivered Message
54
- Content-Type: message/rfc822
55
-
56
- Return-Path: <info@example.jp>
57
- Received: by localhost (Postfix, from userid 1004)
58
- id EAE03161D91; Fri, 17 Aug 2012 23:05:00 +0900 (JST)
59
- Date: Fri, 17 Aug 2012 23:05:00 +0900
60
- From: info@example.jp
61
- To: unknown@docomo.ne.jp
62
- Message-ID: <502e4f8c8dc0a_1ed1cbf30467885@mail>
63
- Subject: =?Shift_JIS?B?dGVzdA==?=
64
- Mime-Version: 1.0
65
- Content-Type: text/plain;
66
- charset=Shift_JIS
67
- Content-Transfer-Encoding: 7bit
68
-
69
- test
70
-
71
- --EAE03161D91.1345212301/localhost--
72
-
@@ -1,44 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path(File.join(File.dirname(__FILE__), '/../spec_helper'))
3
-
4
- describe DecoratedMailer do
5
- include Jpmobile::Util
6
-
7
- before(:each) do
8
- ActionMailer::Base.deliveries = []
9
- end
10
-
11
- shared_examples_for "content-type" do
12
- it "sends decorated mail successfully" do
13
- DecoratedMailer.deco_mail(@to).deliver
14
-
15
- email = ActionMailer::Base.deliveries.first
16
- email.header['Content-Type'].main_type.should == 'multipart'
17
- email.header['Content-Type'].sub_type.should == 'mixed'
18
- end
19
- end
20
-
21
- describe "docomo" do
22
- before(:each) do
23
- @to = "docomo@docomo.ne.jp"
24
- end
25
-
26
- it_behaves_like "content-type"
27
- end
28
-
29
- describe "au" do
30
- before(:each) do
31
- @to = "au@ezweb.ne.jp"
32
- end
33
-
34
- it_behaves_like "content-type"
35
- end
36
-
37
- describe "softbank" do
38
- before(:each) do
39
- @to = "softbank@softbank.ne.jp"
40
- end
41
-
42
- it_behaves_like "content-type"
43
- end
44
- end
@@ -1,2 +0,0 @@
1
- require './guestbook'
2
- run Guestbook
@@ -1 +0,0 @@
1
- PC
@@ -1 +0,0 @@
1
- MOBILE
data/tools/e4u_conv.rb DELETED
@@ -1,122 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require 'nokogiri'
3
- require 'scanf'
4
- require 'pp'
5
-
6
- xml = Nokogiri::XML(open(File.join(File.dirname(__FILE__), 'emoji4unicode.xml')).read)
7
-
8
- google_docomo = []
9
- google_kddi = []
10
- google_softbank = []
11
- unicode_docomo = []
12
- unicode_kddi = []
13
- unicode_softbank = []
14
-
15
- xml.xpath('//e').each do |emoji|
16
- # keycode
17
- google = emoji.attributes['google'].value rescue nil
18
- unicode = emoji.attributes['unicode'].value rescue nil
19
-
20
- # carrier code
21
- docomo = emoji.attributes['docomo'].value rescue '3013'
22
- softbank = emoji.attributes['softbank'].value rescue '3013'
23
- kddi = emoji.attributes['kddi'].value rescue '3013'
24
-
25
- # fix google key
26
- google = nil if google and google.match(/[^0-9a-fA-F\+]/)
27
- # fix unicode key
28
- if unicode
29
- if unicode.match(/\+/)
30
- unicodes = unicode.split(/\+/).delete_if{|e| e.strip == ''}
31
- if unicodes.size == 1
32
- unicode = '0x%s' % unicodes.first
33
- else
34
- unicode = '[' + unicodes.map{|e| '0x%s' % e.gsub(/[^0-9a-fA-F\+]/, '')}.join(', ') + ']'
35
- end
36
- else
37
- unicode = '0x%s' % unicode
38
- end
39
- end
40
-
41
- # fix docomo code
42
- if docomo.match(/\+/)
43
- docomo = '"' + docomo.split('+').map{|e| '&#x%s;' % e.gsub(/[^0-9a-fA-F\+]/, '')}.join('') + '"'
44
- else
45
- docomo = '0x%s' % docomo.gsub(/[^0-9a-fA-F]/, '')
46
- end
47
- # fix softbank code
48
- if softbank.match(/\+/)
49
- softbank = '"' + softbank.split('+').delete_if{|e| e.strip == ''}.map{|s| '&#x%X;' % (s.gsub(/[^0-9a-fA-F\+]/, '').scanf("%x").first + 0x1000)}.join('') + '"'
50
- else
51
- if softbank.match(/3013/)
52
- softbank = '0x%s' % softbank
53
- else
54
- softbank = '0x%X' % (softbank.gsub(/[^0-9a-fA-F]/, '').scanf('%x').first + 0x1000)
55
- end
56
- end
57
- # fix kddi code
58
- if kddi.match(/\+/)
59
- kddi = '"' + kddi.split('+').map{|e| '&#x%s;' % e.gsub(/[^0-9a-fA-F\+]/, '')}.join('') + '"'
60
- else
61
- kddi = '0x%s' % kddi.gsub(/[^0-9a-fA-F]/, '')
62
- end
63
-
64
- if google
65
- google_docomo << [google, docomo]
66
- google_kddi << [google, kddi]
67
- google_softbank << [google, softbank]
68
- end
69
-
70
- if unicode
71
- # Unicode 絵文字は SoftBank に寄せる
72
- unicode_docomo << [unicode, docomo]
73
- unicode_kddi << [unicode, kddi]
74
- unicode_softbank << [unicode, softbank]
75
- end
76
- end
77
-
78
- google_emoji_rb = open(File.join(File.dirname(__FILE__), '/../lib/jpmobile/emoticon/google.rb'), 'w') do |f|
79
- # docomo
80
- f.puts 'Jpmobile::Emoticon::GOOGLE_TO_DOCOMO_UNICODE = {'
81
- google_docomo.each do |google, docomo|
82
- f.puts " 0x%s => %s," % [google, docomo]
83
- end
84
- f.puts '}'
85
-
86
- # kddi
87
- f.puts 'Jpmobile::Emoticon::GOOGLE_TO_AU_UNICODE = {'
88
- google_kddi.each do |google, kddi|
89
- f.puts " 0x%s => %s," % [google, kddi]
90
- end
91
- f.puts '}'
92
-
93
- # softbank
94
- f.puts 'Jpmobile::Emoticon::GOOGLE_TO_SOFTBANK_UNICODE = {'
95
- google_softbank.each do |google, softbank|
96
- f.puts " 0x%s => %s," % [google, softbank]
97
- end
98
- f.puts '}'
99
- end
100
-
101
- unicode_emoji_rb = open(File.join(File.dirname(__FILE__), '/../lib/jpmobile/emoticon/unicode.rb'), 'w') do |f|
102
- # docomo
103
- f.puts 'Jpmobile::Emoticon::UNICODE_TO_DOCOMO_UNICODE = {'
104
- unicode_docomo.each do |unicode, docomo|
105
- f.puts " %s => %s," % [unicode, docomo]
106
- end
107
- f.puts '}'
108
-
109
- # docomo
110
- f.puts 'Jpmobile::Emoticon::UNICODE_TO_AU_UNICODE = {'
111
- unicode_kddi.each do |unicode, kddi|
112
- f.puts " %s => %s," % [unicode, kddi]
113
- end
114
- f.puts '}'
115
-
116
- # softbank
117
- f.puts 'Jpmobile::Emoticon::UNICODE_TO_SOFTBANK_UNICODE = {'
118
- unicode_softbank.each do |unicode, softbank|
119
- f.puts " %s => %s," % [unicode, softbank]
120
- end
121
- f.puts '}'
122
- end