jpmobile 1.0.0.pre.4 → 1.0.0.pre.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (233) hide show
  1. data/.rspec +4 -0
  2. data/Gemfile +3 -3
  3. data/VERSION.yml +2 -2
  4. data/jpmobile.gemspec +335 -0
  5. data/lib/jpmobile.rb +0 -1
  6. data/lib/jpmobile/email.rb +47 -21
  7. data/lib/jpmobile/mail.rb +33 -26
  8. data/lib/jpmobile/mailer.rb +2 -0
  9. data/lib/jpmobile/util.rb +3 -3
  10. data/spec/unit/email-fixtures/au-attached.eml +1551 -0
  11. data/spec/unit/email-fixtures/au-decomail.eml +44 -0
  12. data/spec/unit/email-fixtures/au-emoji.eml +19 -0
  13. data/spec/unit/email-fixtures/au-emoji2.eml +45 -0
  14. data/spec/unit/email-fixtures/au-emoji5.eml +24 -0
  15. data/spec/unit/email-fixtures/docomo-emoji.eml +19 -0
  16. data/spec/unit/email-fixtures/docomo-gmail-sjis.eml +45 -0
  17. data/spec/unit/email-fixtures/docomo-jis.eml +20 -0
  18. data/spec/unit/email-fixtures/pc-mail-multi.eml +77 -0
  19. data/spec/unit/email-fixtures/pc-mail-single.eml +29 -0
  20. data/spec/unit/email-fixtures/softbank-blank.eml +20 -0
  21. data/spec/unit/email-fixtures/softbank-emoji-utf8.eml +19 -0
  22. data/spec/unit/email-fixtures/softbank-emoji.eml +19 -0
  23. data/spec/unit/email-fixtures/softbank-gmail-sjis.eml +45 -0
  24. data/spec/unit/email-fixtures/softbank-gmail-utf8.eml +45 -0
  25. data/spec/unit/{detect_by_email_spec.rb → email_spec.rb} +25 -2
  26. data/spec/unit/emoticon_spec.rb +1 -1
  27. data/spec/unit/encoding_spec.rb +1 -1
  28. data/spec/unit/is_carrier_spec.rb +1 -1
  29. data/spec/unit/mail_spec.rb +1 -1
  30. data/spec/unit/receive_mail_spec.rb +26 -1
  31. data/spec/unit/util_spec.rb +1 -1
  32. data/spec/unit/valid_ip_spec.rb +1 -1
  33. data/test/rails/.gitignore +1 -0
  34. data/test/rails/overrides/.rspec +5 -0
  35. data/test/rails/overrides/Gemfile +33 -0
  36. data/test/rails/overrides/app/views/filter/index.html.erb +0 -0
  37. data/test/rails/overrides/app/views/hankaku_filter/index.html.erb +0 -0
  38. data/test/rails/overrides/app/views/hankaku_input_filter/index.html.erb +0 -0
  39. data/test/rails/overrides/app/views/hankaku_input_filter/index_xhtml.html.erb +1 -0
  40. data/test/rails/overrides/app/views/layouts/xhtml.html.erb +12 -0
  41. data/test/rails/overrides/app/views/links/au_gps.html.erb +1 -0
  42. data/test/rails/overrides/app/views/links/au_location.html.erb +1 -0
  43. data/test/rails/overrides/app/views/links/docomo_foma_gps.html.erb +1 -0
  44. data/test/rails/overrides/app/views/links/docomo_openiarea.html.erb +1 -0
  45. data/test/rails/overrides/app/views/links/docomo_utn.html.erb +1 -0
  46. data/test/rails/overrides/app/views/links/link.html.erb +1 -0
  47. data/test/rails/overrides/app/views/links/show_all.html.erb +1 -0
  48. data/test/rails/overrides/app/views/links/softbank_location.html.erb +1 -0
  49. data/test/rails/overrides/app/views/links/willcom_location.html.erb +1 -0
  50. data/test/rails/overrides/app/views/mobile_mailer/multi_message.html.erb +11 -0
  51. data/test/rails/overrides/app/views/mobile_mailer/multi_message.text.erb +2 -0
  52. data/test/rails/overrides/app/views/mobile_mailer/view_selection.html.erb +3 -0
  53. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile.html.erb +3 -0
  54. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_au.html.erb +3 -0
  55. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_docomo.html.erb +3 -0
  56. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_emobile.html.erb +3 -0
  57. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_softbank.html.erb +3 -0
  58. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_vodafone.html.erb +3 -0
  59. data/test/rails/overrides/app/views/mobile_mailer/view_selection_mobile_willcom.html.erb +3 -0
  60. data/test/rails/overrides/app/views/normal_mailer/msg.text.erb +3 -0
  61. data/test/rails/overrides/app/views/template_path/_partial.html.erb +1 -0
  62. data/test/rails/overrides/app/views/template_path/_partial_mobile.html.erb +1 -0
  63. data/test/rails/overrides/app/views/template_path/_partial_mobile_docomo.html.erb +1 -0
  64. data/test/rails/overrides/app/views/template_path/_partial_smart_phone.html.erb +1 -0
  65. data/test/rails/overrides/app/views/template_path/_partial_smart_phone_iphone.html.erb +1 -0
  66. data/test/rails/overrides/app/views/template_path/index.html.erb +1 -0
  67. data/test/rails/overrides/app/views/template_path/index_mobile.html.erb +1 -0
  68. data/test/rails/overrides/app/views/template_path/index_mobile_docomo.html.erb +1 -0
  69. data/test/rails/overrides/app/views/template_path/index_smart_phone.html.erb +1 -0
  70. data/test/rails/overrides/app/views/template_path/index_smart_phone_iphone.html.erb +1 -0
  71. data/test/rails/overrides/app/views/template_path/partial.html.erb +2 -0
  72. data/test/rails/overrides/app/views/template_path/show_mobile.html.erb +1 -0
  73. data/test/rails/overrides/app/views/template_path/show_mobile_docomo.html.erb +1 -0
  74. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-attached.eml +1551 -0
  75. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-decomail.eml +44 -0
  76. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji.eml +19 -0
  77. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji2.eml +45 -0
  78. data/test/rails/overrides/spec/fixtures/mobile_mailer/au-emoji5.eml +24 -0
  79. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-emoji.eml +19 -0
  80. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-gmail-sjis.eml +45 -0
  81. data/test/rails/overrides/spec/fixtures/mobile_mailer/docomo-jis.eml +20 -0
  82. data/test/rails/overrides/spec/fixtures/mobile_mailer/no-from.eml +78 -0
  83. data/test/rails/overrides/spec/fixtures/mobile_mailer/non-jp.eml +45 -0
  84. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-blank.eml +20 -0
  85. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-emoji-utf8.eml +19 -0
  86. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-emoji.eml +19 -0
  87. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-gmail-sjis.eml +45 -0
  88. data/test/rails/overrides/spec/fixtures/mobile_mailer/softbank-gmail-utf8.eml +45 -0
  89. data/test/rails/overrides/spec/helpers/helpers_spec.rb +1 -2
  90. data/test/rails/overrides/spec/models/mobile_mailer_spec.rb +37 -1
  91. data/test/rails/overrides/spec/models/normal_mailer_spec.rb +1 -1
  92. data/test/rails/overrides/spec/rcov.opts +2 -0
  93. data/test/rails/overrides/spec/requests/docomo_guid_spec.rb +1 -2
  94. data/test/rails/overrides/spec/requests/docomo_spec.rb +1 -2
  95. data/test/rails/overrides/spec/requests/emobile_spec.rb +1 -2
  96. data/test/rails/overrides/spec/requests/filter_spec.rb +1 -1
  97. data/test/rails/overrides/spec/requests/helpers_spec.rb +1 -1
  98. data/test/rails/overrides/spec/requests/pc_spec.rb +1 -2
  99. data/test/rails/overrides/spec/requests/softbank_emulator_spec.rb +1 -2
  100. data/test/rails/overrides/spec/requests/template_path_spec.rb +1 -2
  101. data/test/rails/overrides/spec/requests/trans_sid_spec.rb +1 -2
  102. data/test/rails/overrides/spec/spec_helper.rb +1 -1
  103. metadata +229 -386
  104. data/test/rails/rails_root/app/controllers/application_controller.rb +0 -6
  105. data/test/rails/rails_root/app/controllers/docomo_guid_always_controller.rb +0 -3
  106. data/test/rails/rails_root/app/controllers/docomo_guid_base_controller.rb +0 -5
  107. data/test/rails/rails_root/app/controllers/docomo_guid_docomo_controller.rb +0 -3
  108. data/test/rails/rails_root/app/controllers/filter_controller.rb +0 -3
  109. data/test/rails/rails_root/app/controllers/filter_controller_base.rb +0 -25
  110. data/test/rails/rails_root/app/controllers/hankaku_filter_controller.rb +0 -3
  111. data/test/rails/rails_root/app/controllers/hankaku_input_filter_controller.rb +0 -7
  112. data/test/rails/rails_root/app/controllers/links_controller.rb +0 -28
  113. data/test/rails/rails_root/app/controllers/mobile_spec_controller.rb +0 -5
  114. data/test/rails/rails_root/app/controllers/template_path_controller.rb +0 -17
  115. data/test/rails/rails_root/app/controllers/trans_sid_always_and_session_off_controller.rb +0 -4
  116. data/test/rails/rails_root/app/controllers/trans_sid_always_controller.rb +0 -3
  117. data/test/rails/rails_root/app/controllers/trans_sid_base_controller.rb +0 -40
  118. data/test/rails/rails_root/app/controllers/trans_sid_metal_controller.rb +0 -15
  119. data/test/rails/rails_root/app/controllers/trans_sid_mobile_controller.rb +0 -3
  120. data/test/rails/rails_root/app/controllers/trans_sid_none_controller.rb +0 -3
  121. data/test/rails/rails_root/app/helpers/application_helper.rb +0 -2
  122. data/test/rails/rails_root/app/models/mobile_mailer.rb +0 -19
  123. data/test/rails/rails_root/app/models/normal_mailer.rb +0 -9
  124. data/test/rails/rails_root/app/models/user.rb +0 -2
  125. data/test/rails/rails_root/autotest/discover.rb +0 -2
  126. data/test/rails/rails_root/config/application.rb +0 -42
  127. data/test/rails/rails_root/config/boot.rb +0 -6
  128. data/test/rails/rails_root/config/environment.rb +0 -5
  129. data/test/rails/rails_root/config/environments/development.rb +0 -26
  130. data/test/rails/rails_root/config/environments/production.rb +0 -49
  131. data/test/rails/rails_root/config/environments/test.rb +0 -35
  132. data/test/rails/rails_root/config/initializers/backtrace_silencers.rb +0 -7
  133. data/test/rails/rails_root/config/initializers/inflections.rb +0 -10
  134. data/test/rails/rails_root/config/initializers/jpmobile_generator.rb +0 -2
  135. data/test/rails/rails_root/config/initializers/mime_types.rb +0 -5
  136. data/test/rails/rails_root/config/initializers/secret_token.rb +0 -7
  137. data/test/rails/rails_root/config/initializers/session_store.rb +0 -2
  138. data/test/rails/rails_root/config/routes.rb +0 -7
  139. data/test/rails/rails_root/db/migrate/001_add_sessions_table.rb +0 -16
  140. data/test/rails/rails_root/db/migrate/20100824062306_create_users.rb +0 -13
  141. data/test/rails/rails_root/db/schema.rb +0 -31
  142. data/test/rails/rails_root/db/seeds.rb +0 -7
  143. data/test/rails/rails_root/spec/helpers/helpers_spec.rb +0 -15
  144. data/test/rails/rails_root/spec/models/mobile_mailer_spec.rb +0 -737
  145. data/test/rails/rails_root/spec/models/normal_mailer_spec.rb +0 -34
  146. data/test/rails/rails_root/spec/requests/docomo_guid_spec.rb +0 -102
  147. data/test/rails/rails_root/spec/requests/docomo_spec.rb +0 -33
  148. data/test/rails/rails_root/spec/requests/emobile_spec.rb +0 -53
  149. data/test/rails/rails_root/spec/requests/filter_spec.rb +0 -221
  150. data/test/rails/rails_root/spec/requests/helpers_spec.rb +0 -187
  151. data/test/rails/rails_root/spec/requests/pc_spec.rb +0 -22
  152. data/test/rails/rails_root/spec/requests/softbank_emulator_spec.rb +0 -21
  153. data/test/rails/rails_root/spec/requests/template_path_spec.rb +0 -240
  154. data/test/rails/rails_root/spec/requests/trans_sid_spec.rb +0 -207
  155. data/test/rails/rails_root/spec/spec_helper.rb +0 -38
  156. data/test/rails/rails_root/test/performance/browsing_test.rb +0 -9
  157. data/test/rails/rails_root/test/test_helper.rb +0 -13
  158. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile-ipaddresses.rb +0 -18
  159. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb +0 -23
  160. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/au.rb +0 -40
  161. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/docomo.rb +0 -22
  162. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/emobile.rb +0 -15
  163. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/softbank.rb +0 -20
  164. data/test/rails/rails_root/vendor/plugins/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/willcom.rb +0 -158
  165. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile-terminfo.rb +0 -9
  166. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile/mobile/terminfo.rb +0 -62
  167. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/lib/jpmobile/mobile/terminfo/docomo.rb +0 -739
  168. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/spec/spec_helper.rb +0 -2
  169. data/test/rails/rails_root/vendor/plugins/jpmobile-terminfo/spec/terminfo_spec.rb +0 -54
  170. data/test/rails/rails_root/vendor/plugins/jpmobile/init.rb +0 -3
  171. data/test/rails/rails_root/vendor/plugins/jpmobile/install.rb +0 -1
  172. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile.rb +0 -59
  173. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/datum_conv.rb +0 -72
  174. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/docomo_guid.rb +0 -43
  175. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/email.rb +0 -33
  176. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon.rb +0 -205
  177. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/au.rb +0 -1931
  178. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/conversion_table.rb +0 -3909
  179. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/docomo.rb +0 -255
  180. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/softbank.rb +0 -965
  181. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/emoticon/z_combine.rb +0 -36
  182. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/encoding.rb +0 -29
  183. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/filter.rb +0 -113
  184. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/helpers.rb +0 -174
  185. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_controller.rb +0 -18
  186. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_dispatch.rb +0 -2
  187. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/hook_action_view.rb +0 -33
  188. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/lookup_context.rb +0 -2
  189. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mail.rb +0 -330
  190. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mailer.rb +0 -41
  191. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/abstract_mobile.rb +0 -168
  192. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/android.rb +0 -10
  193. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/au.rb +0 -128
  194. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/ddipocket.rb +0 -12
  195. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/docomo.rb +0 -149
  196. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/emobile.rb +0 -16
  197. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/iphone.rb +0 -26
  198. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/smart_phone.rb +0 -21
  199. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/softbank.rb +0 -91
  200. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/vodafone.rb +0 -17
  201. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/willcom.rb +0 -28
  202. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/mobile/windows_phone.rb +0 -10
  203. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/path_set.rb +0 -40
  204. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/position.rb +0 -68
  205. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack.rb +0 -49
  206. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/filter.rb +0 -50
  207. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/mobile_carrier.rb +0 -33
  208. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rack/params_filter.rb +0 -47
  209. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/rails.rb +0 -50
  210. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/request_with_mobile.rb +0 -45
  211. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/resolver.rb +0 -38
  212. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/trans_sid.rb +0 -133
  213. data/test/rails/rails_root/vendor/plugins/jpmobile/lib/jpmobile/util.rb +0 -370
  214. data/test/rails/rails_root/vendor/plugins/jpmobile/tmp/conversion-table.rb +0 -2588
  215. data/test/rails/rails_root/vendor/plugins/jpmobile/tmp/utf8_to_image.rb +0 -1407
  216. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/emoji/genregexp.rb +0 -47
  217. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_au_emoticon_table.rb +0 -34
  218. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_docomo_emoticon_table.rb +0 -33
  219. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_emoticon_conversion_table.rb +0 -107
  220. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/generate_softbank_emoticon_table.rb +0 -31
  221. data/test/rails/rails_root/vendor/plugins/jpmobile/tools/list_gps_unsupported_au.rb +0 -23
  222. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile-ipaddresses.rb +0 -18
  223. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/abstract_ip_addresses.rb +0 -23
  224. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/au.rb +0 -40
  225. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/docomo.rb +0 -22
  226. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/emobile.rb +0 -15
  227. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/softbank.rb +0 -20
  228. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-ipaddresses/lib/jpmobile/mobile/ip_addresses/willcom.rb +0 -158
  229. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile-terminfo.rb +0 -9
  230. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile/mobile/terminfo.rb +0 -62
  231. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/lib/jpmobile/mobile/terminfo/docomo.rb +0 -739
  232. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/spec/spec_helper.rb +0 -2
  233. data/test/rails/rails_root/vendor/plugins/jpmobile/vendor/jpmobile-terminfo/spec/terminfo_spec.rb +0 -54
@@ -1,2 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.join(File.expand_path(File.dirname(__FILE__)), '../lib/jpmobile-terminfo')
@@ -1,54 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.join(File.expand_path(File.dirname(__FILE__)), 'spec_helper')
3
-
4
- # dummy classes
5
- module Jpmobile::Mobile
6
- class Docomo; end
7
- class Au; end
8
- class Softbank; end
9
- end
10
-
11
- describe Jpmobile::Mobile::Terminfo do
12
- def mock_carrier(carrier, stubs={ })
13
- @mock_carrier = eval("Jpmobile::Mobile::#{carrier}").new
14
- @mock_carrier.stub(stubs)
15
- @mock_carrier
16
- end
17
-
18
- context "docomoの場合" do
19
- it "端末情報を取得できること" do
20
- terminfo = Jpmobile::Mobile::Terminfo.new(mock_carrier("Docomo", {:model_name => 'SH906i'}), {})
21
- terminfo.color?.should be_true
22
- terminfo.colors.should == 16777216
23
- terminfo.width.should == 240
24
- terminfo.height.should == 320
25
- end
26
- end
27
-
28
- context "auの場合" do
29
- it "端末情報を取得できること" do
30
- terminfo = Jpmobile::Mobile::Terminfo.new(mock_carrier("Au"), {
31
- 'HTTP_X_UP_DEVCAP_SCREENPIXELS' => "240,348",
32
- 'HTTP_X_UP_DEVCAP_ISCOLOR' => "1",
33
- 'HTTP_X_UP_DEVCAP_SCREENDEPTH' => "16,RGB565"
34
- })
35
- terminfo.color?.should be_true
36
- terminfo.colors.should == 65536
37
- terminfo.width.should == 240
38
- terminfo.height.should == 348
39
- end
40
- end
41
-
42
- context "softbankの場合" do
43
- it "端末情報を取得できること" do
44
- terminfo = Jpmobile::Mobile::Terminfo.new(mock_carrier("Softbank"), {
45
- 'HTTP_X_JPHONE_DISPLAY' => "240*320",
46
- 'HTTP_X_JPHONE_COLOR' => "C262144"
47
- })
48
- terminfo.color?.should be_true
49
- terminfo.colors.should == 262144
50
- terminfo.width.should == 240
51
- terminfo.height.should == 320
52
- end
53
- end
54
- end
@@ -1,3 +0,0 @@
1
- # Include hook code here
2
-
3
- require File.join(File.dirname(__FILE__), 'lib/jpmobile')
@@ -1 +0,0 @@
1
- # Install hook code here
@@ -1,59 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- $:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) ||
3
- $:.include?(File.expand_path(File.dirname(__FILE__)))
4
-
5
- module Jpmobile
6
- autoload :Email, 'jpmobile/email'
7
- autoload :Emoticon, 'jpmobile/emoticon'
8
- autoload :Position, 'jpmobile/position'
9
- autoload :RequestWithMobile, 'jpmobile/request_with_mobile'
10
- autoload :Util, 'jpmobile/util'
11
- autoload :Encoding, 'jpmobile/encoding'
12
- autoload :Version, 'jpmobile/version'
13
- autoload :DatumConv, 'jpmobile/datum_conv'
14
-
15
- # autoload mobile classes
16
- module Mobile
17
- autoload :Docomo, 'jpmobile/mobile/docomo'
18
- autoload :Au, 'jpmobile/mobile/au'
19
- autoload :Softbank, 'jpmobile/mobile/softbank'
20
- autoload :Vodafone, 'jpmobile/mobile/vodafone'
21
- autoload :Emobile, 'jpmobile/mobile/emobile'
22
- autoload :Willcom, 'jpmobile/mobile/willcom'
23
- autoload :Ddipocket, 'jpmobile/mobile/ddipocket'
24
- autoload :SmartPhone, 'jpmobile/mobile/smart_phone'
25
- autoload :Iphone, 'jpmobile/mobile/iphone'
26
- autoload :Android, 'jpmobile/mobile/android'
27
- autoload :WindowsPhone, 'jpmobile/mobile/windows_phone'
28
-
29
- autoload :Display, 'jpmobile/mobile/display'
30
-
31
- DEFAULT_CARRIERS = %w(Docomo Au Softbank Vodafone Emobile Willcom Ddipocket Iphone Android WindowsPhone)
32
-
33
- def self.carriers
34
- @carriers ||= DEFAULT_CARRIERS.dup
35
- end
36
-
37
- def self.carriers=(ary)
38
- @carriers = ary
39
- end
40
-
41
- require 'jpmobile/mobile/abstract_mobile'
42
- end
43
-
44
- # autoload Rack middlewares
45
- module Rack
46
- autoload :MobileCarrier, 'jpmobile/rack/mobile_carrier'
47
- autoload :ParamsFilter, 'jpmobile/rack/params_filter'
48
- autoload :Filter, 'jpmobile/rack/filter'
49
- autoload :Config, 'jpmobile/rack/config'
50
- end
51
- autoload :Configuration, 'jpmobile/rack'
52
-
53
- autoload :Mailer, 'jpmobile/mailer'
54
- autoload :Resolver, 'jpmobile/resolver'
55
- end
56
-
57
- if defined?(Rails)
58
- require 'jpmobile/rails'
59
- end
@@ -1,72 +0,0 @@
1
- # =測地系変換モジュール
2
- #
3
- # 参考文献:
4
- # 飛田幹男, 世界測地系と座標変換--21世紀の測量士・位置情報ユーザ・プログラマーのために,
5
- # 日本測量協会, 2002.
6
-
7
- module DatumConv
8
- GRS80 = [ 6378137, 298.257222101]
9
- Bessel = [6377397.155, 299.152813]
10
- Tokyo97toITRF94 = [-146.414, 507.337, 680.507]
11
- ITRF94toTokyo97 = [ 146.414,-507.337,-680.507]
12
- Deg2Rad = Math::PI/180
13
-
14
- # 緯度(度),経度(度),高度(m)を三次元直交座標(m)に変換する。
15
- def self.blh2xyz(b_deg,l_deg,he,datum)
16
- a = datum[0].to_f
17
- f = 1.0/datum[1]
18
- b = b_deg * Deg2Rad
19
- l = l_deg * Deg2Rad
20
-
21
- e2 = f * (2 - f)
22
- n = a / Math.sqrt(1 - e2 * Math.sin(b)**2 )
23
-
24
- x = (n+he)*Math.cos(b)*Math.cos(l)
25
- y = (n+he)*Math.cos(b)*Math.sin(l)
26
- z = (n*(1-e2)+he)*Math.sin(b)
27
- return x,y,z
28
- end
29
-
30
- # 三次元直交座標(m)を緯度(度),経度(度),高度(m)に変換する。
31
- def self.xyz2blh(x,y,z,datum)
32
- a = datum[0].to_f
33
- f = 1.0/datum[1]
34
- e2 = f * (2 - f)
35
- l = Math.atan2(y,x)
36
-
37
- p = Math.sqrt(x**2+y**2)
38
- r = Math.sqrt(p**2+z**2)
39
- u = Math.atan2(z*((1-f)+e2*a/r),p)
40
- b = Math.atan2(z*(1-f)+e2*a*Math.sin(u)**3,(1-f)*(p-e2*a*Math.cos(u)**3))
41
-
42
- he = p*Math.cos(b) + z*Math.sin(b) - a*Math.sqrt(1-e2*Math.sin(b)**2)
43
-
44
- b_deg = b / Deg2Rad
45
- l_deg = l / Deg2Rad
46
- return b_deg,l_deg,he
47
- end
48
-
49
- # 三次元直交座標でシフトする。
50
- def self.xyz2xyz(x,y,z,d)
51
- return x+d[0],y+d[1],z+d[2]
52
- end
53
-
54
- # 日本測地系から世界測地系に変換する。
55
- def self.tky2jgd(b,l,he=0)
56
- x,y,z = blh2xyz(b,l,he,Bessel)
57
- x,y,z = xyz2xyz(x,y,z,Tokyo97toITRF94)
58
- b,l,he = xyz2blh(x,y,z,GRS80)
59
- return b,l,he
60
- end
61
-
62
- # 世界測地系から日本測地系に変換する。
63
- def self.jgd2tky(b,l,he=0)
64
- x,y,z = blh2xyz(b,l,he,GRS80)
65
- x,y,z = xyz2xyz(x,y,z,ITRF94toTokyo97)
66
- b,l,he = xyz2blh(x,y,z,Bessel)
67
- return b,l,he
68
- end
69
- end
70
-
71
- #DatumConv.tky2jgd(b,l)
72
- #DatumConv.jgd2tky(b,l)
@@ -1,43 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #DoCoMoの時guid=onの付与
3
- class ActionController::Base #:nodoc:
4
- class_inheritable_accessor :docomo_guid_mode
5
-
6
- class << self
7
- def docomo_guid(mode=:docomo)
8
- include Jpmobile::DocomoGuid
9
- self.docomo_guid_mode = mode
10
- end
11
- end
12
- end
13
-
14
-
15
- module Jpmobile::DocomoGuid #:nodoc:
16
- protected
17
- def default_url_options
18
- result = super || {}
19
- return result unless request # for test process
20
- return result unless apply_add_guid?
21
- return result.merge({:guid => "ON"})
22
- end
23
-
24
- #guid=ONを付与すべきか否かを返す
25
- def apply_add_guid?
26
- return true if docomo_guid_mode == :always
27
- return false if docomo_guid_mode == :none
28
-
29
- return false unless request.mobile?
30
- return false unless request.mobile.is_a?(Jpmobile::Mobile::Docomo)
31
- return false if not_apply_guid_user_agent?
32
-
33
- if docomo_guid_mode == :valid_ip
34
- return false unless request.mobile.valid_ip?
35
- end
36
-
37
- return true
38
- end
39
-
40
- def not_apply_guid_user_agent?
41
- request.user_agent.match(/(?:Googlebot|Y!J-SRD\/1\.0|Y!J-MBS\/1\.0)/)
42
- end
43
- end
@@ -1,33 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # =メールアドレスモジュール
3
- #
4
- module Jpmobile
5
- # email関連の処理
6
- module Email
7
- module_function
8
-
9
- # メールアドレスよりキャリア情報を取得する
10
- # _param1_:: email メールアドレス
11
- # return :: Jpmobile::Mobileで定義されている携帯キャリアクラス
12
- def detect(email)
13
- Mobile.carriers.each do |const|
14
- c = Mobile.const_get(const)
15
- return c if c::MAIL_ADDRESS_REGEXP && email.match(/^#{c::MAIL_ADDRESS_REGEXP}$/)
16
- end
17
- nil
18
- end
19
-
20
- # 含まれているメールアドレスからキャリア情報を取得する
21
- def detect_from_mail_header(str)
22
- Mobile.carriers.each do |const|
23
- c = Mobile.const_get(const)
24
- if c::MAIL_ADDRESS_REGEXP &&
25
- str.match(/(\S+@[A-Za-z0-9\-\.\_]+)/) &&
26
- $1.match(/^#{c::MAIL_ADDRESS_REGEXP}$/)
27
- return c
28
- end
29
- end
30
- nil
31
- end
32
- end
33
- end
@@ -1,205 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
-
3
- require 'scanf'
4
- require 'nkf'
5
-
6
- module Jpmobile
7
- # 絵文字関連処理
8
- module Emoticon
9
- %w( DOCOMO_SJIS_TO_UNICODE DOCOMO_UNICODE_TO_SJIS ).each do |const|
10
- autoload const, 'jpmobile/emoticon/docomo'
11
- end
12
- %w( AU_SJIS_TO_UNICODE AU_UNICODE_TO_EMAILJIS AU_SJIS_TO_EMAIL_JIS AU_EMAILJIS_TO_UNICODE ).each do |const|
13
- autoload const, 'jpmobile/emoticon/au'
14
- end
15
- %w(
16
- SOFTBANK_UNICODE_TO_WEBCODE SOFTBANK_WEBCODE_TO_UNICODE
17
- SOFTBANK_UNICODE_TO_SJIS SOFTBANK_SJIS_TO_UNICODE
18
- ).each do |const|
19
- autoload const, 'jpmobile/emoticon/softbank'
20
- end
21
- %w( CONVERSION_TABLE_TO_DOCOMO CONVERSION_TABLE_TO_AU CONVERSION_TABLE_TO_SOFTBANK ).each do |const|
22
- autoload const, 'jpmobile/emoticon/conversion_table'
23
- end
24
- %w(
25
- SJIS_TO_UNICODE UNICODE_TO_SJIS
26
- SJIS_REGEXP SOFTBANK_WEBCODE_REGEXP DOCOMO_SJIS_REGEXP AU_SJIS_REGEXP SOFTBANK_UNICODE_REGEXP
27
- EMOTICON_UNICODES UTF8_REGEXP
28
- CONVERSION_TABLE_TO_PC_EMAIL SOFTBANK_SJIS_REGEXP AU_EMAILJIS_REGEXP
29
- ).each do |const|
30
- autoload const, 'jpmobile/emoticon/z_combine'
31
- end
32
-
33
- # +str+ のなかでDoCoMo絵文字をUnicode数値文字参照に置換した文字列を返す。
34
- def self.external_to_unicodecr_docomo(str)
35
- str.gsub(DOCOMO_SJIS_REGEXP) do |match|
36
- sjis = match.unpack('n').first
37
- unicode = DOCOMO_SJIS_TO_UNICODE[sjis]
38
- unicode ? ("&#x%04x;"%unicode) : match
39
- end
40
- end
41
-
42
- # +str+ のなかでau絵文字をUnicode数値文字参照に置換した文字列を返す。
43
- def self.external_to_unicodecr_au(str)
44
- str.gsub(AU_SJIS_REGEXP) do |match|
45
- sjis = match.unpack('n').first
46
- unicode = AU_SJIS_TO_UNICODE[sjis]
47
- unicode ? ("&#x%04x;"%unicode) : match
48
- end
49
- end
50
-
51
- # +str+ のなかでau絵文字をUnicode数値文字参照に置換した文字列を返す。(メール専用)
52
- def self.external_to_unicodecr_au_mail(in_str)
53
- str = Jpmobile::Util.ascii_8bit(in_str)
54
- str.gsub(Jpmobile::Util.jis_string_regexp) do |jis_string|
55
- jis_string.gsub(/[\x21-\x7e]{2}/) do |match|
56
- jis = match.unpack('n').first
57
- unicode = AU_EMAILJIS_TO_UNICODE[jis]
58
- unicode ? Jpmobile::Util.ascii_8bit("\x1b\x28\x42&#x%04x;\x1b\x24\x42"%unicode) : match
59
- end
60
- end
61
- end
62
-
63
- # +str+のなかでUTF8のSoftBank絵文字を(+0x1000だけシフトして)Unicode数値文字参照に変換した文字列を返す。
64
- def self.external_to_unicodecr_softbank(str)
65
- # SoftBank Unicode
66
- str.gsub(SOFTBANK_UNICODE_REGEXP) do |match|
67
- unicode = match.unpack('U').first
68
- "&#x%04x;" % (unicode+0x1000)
69
- end
70
- end
71
- def self.external_to_unicodecr_softbank_sjis(str)
72
- # SoftBank Shift_JIS
73
- str.gsub(SOFTBANK_SJIS_REGEXP) do |match|
74
- sjis = match.unpack('n').first
75
- unicode = SOFTBANK_SJIS_TO_UNICODE[sjis]
76
- "&#x%04x;" % (unicode+0x1000)
77
- end
78
- end
79
- def self.external_to_unicodecr_vodafone(str)
80
- external_to_unicodecr_softbank(str)
81
- end
82
-
83
- # +str+ のなかでUnicode数値文字参照で表記された絵文字を携帯側エンコーディングに置換する。
84
- #
85
- # キャリア間の変換に +conversion_table+ を使う。+conversion_table+ に+nil+を与えると、
86
- # キャリア間の変換は行わない。
87
- #
88
- # 携帯側エンコーディングがShift_JIS場合は +to_sjis+ に +true+ を指定する。
89
- # +true+ を指定すると変換テーブルに文字列が指定されている場合にShift_JISで出力される。
90
- def self.unicodecr_to_external(str, conversion_table=nil, to_sjis=true)
91
- str.gsub(/&#x([0-9a-f]{4});/i) do |match|
92
- unicode = $1.scanf("%x").first
93
- if conversion_table
94
- converted = conversion_table[unicode] # キャリア間変換
95
- else
96
- converted = unicode # 変換しない
97
- end
98
-
99
- # 携帯側エンコーディングに変換する
100
- case converted
101
- when Integer
102
- # 変換先がUnicodeで指定されている。つまり対応する絵文字がある。
103
- if sjis = UNICODE_TO_SJIS[converted]
104
- if to_sjis
105
- sjis_emotion = Jpmobile::Util.sjis([sjis].pack('n'))
106
- else
107
- [converted].pack("U")
108
- end
109
- elsif webcode = SOFTBANK_UNICODE_TO_WEBCODE[converted-0x1000]
110
- [converted-0x1000].pack('U')
111
- elsif converted == GETA
112
- # PCで〓を表示する場合
113
- [GETA].pack("U")
114
- else
115
- # キャリア変換テーブルに指定されていたUnicodeに対応する
116
- # 携帯側エンコーディングが見つからない(変換テーブルの不備の可能性あり)。
117
- match
118
- end
119
- when String
120
- # 変換先が数値参照だと、再変換する
121
- if converted.match(/&#x([0-9a-f]{4});/i)
122
- self.unicodecr_to_external(converted, conversion_table, to_sjis)
123
- else
124
- # 変換先が文字列で指定されている。
125
- to_sjis ? Jpmobile::Util.utf8_to_sjis(converted) : converted
126
- end
127
- when nil
128
- # 変換先が定義されていない。
129
- match
130
- end
131
- end
132
- end
133
- # +str+ のなかでUnicode数値文字参照で表記された絵文字をUTF-8に置換する。
134
- def self.unicodecr_to_utf8(str)
135
- str.gsub(/&#x([0-9a-f]{4});/i) do |match|
136
- unicode = $1.scanf("%x").first
137
- if UNICODE_TO_SJIS[unicode] || SOFTBANK_UNICODE_TO_WEBCODE[unicode-0x1000]
138
- [unicode].pack('U')
139
- else
140
- match
141
- end
142
- end
143
- end
144
- # +str+ のなかでUTF-8で表記された絵文字をUnicode数値文字参照に置換する。
145
- def self.utf8_to_unicodecr(str)
146
- str.gsub(UTF8_REGEXP) do |match|
147
- "&#x%04x;" % match.unpack('U').first
148
- end
149
- end
150
-
151
- # +str+ のなかでUnicode数値文字参照で表記された絵文字をメール送信用JISコードに変換する
152
- # au 専用
153
- def self.unicodecr_to_au_email(in_str)
154
- str = Jpmobile::Util.ascii_8bit(in_str)
155
- regexp = Regexp.compile(Jpmobile::Util.ascii_8bit("&#x([0-9a-f]{4});"), Regexp::IGNORECASE)
156
- str.gsub(regexp) do |match|
157
- unicode = $1.scanf("%x").first
158
- converted = CONVERSION_TABLE_TO_AU[unicode]
159
-
160
- # メール用エンコーディングに変換する
161
- case converted
162
- when Integer
163
- if sjis = UNICODE_TO_SJIS[converted]
164
- if email_jis = SJIS_TO_EMAIL_JIS[sjis]
165
- Jpmobile::Util.ascii_8bit("\x1b\x24\x42#{[email_jis].pack('n')}\x1b\x28\x42")
166
- else
167
- Jpmobile::Util.ascii_8bit([sjis].pack('n'))
168
- end
169
- else
170
- match
171
- end
172
- when String
173
- # FIXME: 絵文字の代替が文章でいいかどうかの検証
174
- Jpmobile::Util.ascii_8bit(Jpmobile::Util.utf8_to_jis(converted))
175
- else
176
- match
177
- end
178
- end
179
- end
180
-
181
- # +str+ のなかでUnicode数値文字参照で表記された絵文字をメール送信用JISコードに変換する
182
- # softbank 専用
183
- def self.unicodecr_to_softbank_email(str)
184
- str.gsub(/&#x([0-9a-f]{4});/i) do |match|
185
- unicode = $1.scanf("%x").first
186
- converted = CONVERSION_TABLE_TO_SOFTBANK[unicode]
187
-
188
- # メール用エンコーディングに変換する
189
- case converted
190
- when Integer
191
- if sjis = SOFTBANK_UNICODE_TO_SJIS[converted-0x1000]
192
- Jpmobile::Util.sjis([sjis].pack('n'))
193
- else
194
- match
195
- end
196
- when String
197
- # FIXME: 絵文字の代替が文章でいいかどうかの検証
198
- Jpmobile::Util.utf8_to_sjis(converted)
199
- else
200
- match
201
- end
202
- end
203
- end
204
- end
205
- end