jpmobile 5.2.2 → 5.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c4b40681d31282cdbf4a8578f6d3525c3b882011650e29520a1af4a859de9113
4
- data.tar.gz: 7453e53f4bb4143a16696a0825dc3f5220922ee97987bcbb804369056e2b5431
3
+ metadata.gz: c92ac3e77de3857e601a5653a647135ec5e5b82e67fe306afba25eaad9a20585
4
+ data.tar.gz: 621199b8e70b5964c2ee1e7a66b9b86c953806a82918419fdf4eeae3320c205c
5
5
  SHA512:
6
- metadata.gz: 6526d0e974937db68f9e53fb7b945e469ff81dd69ad634797f47e521cd25d53770ba9a1d42b64a22dbf0632bff32e07a57de380ff29f716d3166476931cc4aea
7
- data.tar.gz: 6d1a3e74920adaaed5215a810246eb33538944eaf0a1b5c240ecddb4145b55f0d8d27aeca8e0a56c4dd3d0d8a1349cb41a4e3d55379f8d87f9118e3b0e5e6154
6
+ metadata.gz: e0ca9b2c6a50f7c0a55b94ce6020192d0b8de7c737987d45aef5fd566165504d4a3106329217fe2a9d3b1d7334128d8bc50dc0287b0e66b00a8ec80aaf0e83e7
7
+ data.tar.gz: fccba8f4826c4ce692ecb5bee0799737fbfd49fe99515ce41354b2e9cc13a949d86f92972ecd82776cf7a9e54c813c79bd49b9382e0639dc260e9a73dbd0d2ba
@@ -0,0 +1,60 @@
1
+ version: 2
2
+ jobs:
3
+ test-job:
4
+ working_directory: ~/jpmobile
5
+ docker:
6
+ - image: circleci/ruby:2.5-node-browsers
7
+ environment:
8
+ BUNDLE_JOBS: 3
9
+ BUNDLE_RETRY: 3
10
+ BUNDLE_PATH: vendor/bundle
11
+ RAILS_ENV: test
12
+ steps:
13
+ - checkout
14
+
15
+ # Install dependent packages
16
+ - run:
17
+ name: Install dependent packages
18
+ command: sudo apt-get install -y cmake qt5-default libqt5webkit5-dev gstreamer1.0-plugins-base gstreamer1.0-tools gstreamer1.0-x
19
+
20
+ # Which version of bundler?
21
+ - run:
22
+ name: Which bundler?
23
+ command: bundle -v
24
+
25
+ # Restore bundle cache
26
+ - restore_cache:
27
+ keys:
28
+ - jpmobile-bundle-v1-{{ checksum "Gemfile.lock" }}
29
+
30
+ - run:
31
+ name: Bundle Install
32
+ command: bundle check || bundle install --path vendor/bundler
33
+
34
+ # Store bundle cache
35
+ - save_cache:
36
+ key: jpmobile-bundle-v1-{{ checksum "Gemfile.lock" }}
37
+ paths:
38
+ - vendor/bundle
39
+
40
+ # rubocop
41
+ - run:
42
+ name: rubocop
43
+ command: |
44
+ bundle exec rubocop
45
+ environment:
46
+ BUNDLE_GEMFILE: ~/jpmobile/Gemfile
47
+
48
+ # Run rspec in parallel
49
+ - run:
50
+ name: test
51
+ command: |
52
+ bundle exec rake test
53
+
54
+ environment:
55
+ BUNDLE_GEMFILE: ~/jpmobile/Gemfile
56
+ workflows:
57
+ version: 2
58
+ run-test:
59
+ jobs:
60
+ - test-job
data/.rubocop.yml CHANGED
@@ -9,14 +9,12 @@ inherit_gem:
9
9
  AllCops:
10
10
  TargetRubyVersion: 2.4
11
11
  Exclude:
12
- - 'bin/bundle'
13
- - 'bin/rails'
14
- - 'bin/rake'
12
+ - 'bin/*'
15
13
  - 'db/schema.rb'
16
14
  - 'vendor/bundle/**/*'
17
15
  - 'tools/**/*'
18
16
  - 'test/rails/rails_root/**/*'
19
- - 'vendor/jpmobile-*/**/*'
17
+ - 'vendor/**/*'
20
18
 
21
19
  Style/StringLiterals:
22
20
  EnforcedStyle: single_quotes
data/Gemfile.lock CHANGED
@@ -7,43 +7,43 @@ PATH
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (5.2.0)
11
- actionpack (= 5.2.0)
10
+ actioncable (5.2.2)
11
+ actionpack (= 5.2.2)
12
12
  nio4r (~> 2.0)
13
13
  websocket-driver (>= 0.6.1)
14
- actionmailer (5.2.0)
15
- actionpack (= 5.2.0)
16
- actionview (= 5.2.0)
17
- activejob (= 5.2.0)
14
+ actionmailer (5.2.2)
15
+ actionpack (= 5.2.2)
16
+ actionview (= 5.2.2)
17
+ activejob (= 5.2.2)
18
18
  mail (~> 2.5, >= 2.5.4)
19
19
  rails-dom-testing (~> 2.0)
20
- actionpack (5.2.0)
21
- actionview (= 5.2.0)
22
- activesupport (= 5.2.0)
20
+ actionpack (5.2.2)
21
+ actionview (= 5.2.2)
22
+ activesupport (= 5.2.2)
23
23
  rack (~> 2.0)
24
24
  rack-test (>= 0.6.3)
25
25
  rails-dom-testing (~> 2.0)
26
26
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
27
- actionview (5.2.0)
28
- activesupport (= 5.2.0)
27
+ actionview (5.2.2)
28
+ activesupport (= 5.2.2)
29
29
  builder (~> 3.1)
30
30
  erubi (~> 1.4)
31
31
  rails-dom-testing (~> 2.0)
32
32
  rails-html-sanitizer (~> 1.0, >= 1.0.3)
33
- activejob (5.2.0)
34
- activesupport (= 5.2.0)
33
+ activejob (5.2.2)
34
+ activesupport (= 5.2.2)
35
35
  globalid (>= 0.3.6)
36
- activemodel (5.2.0)
37
- activesupport (= 5.2.0)
38
- activerecord (5.2.0)
39
- activemodel (= 5.2.0)
40
- activesupport (= 5.2.0)
36
+ activemodel (5.2.2)
37
+ activesupport (= 5.2.2)
38
+ activerecord (5.2.2)
39
+ activemodel (= 5.2.2)
40
+ activesupport (= 5.2.2)
41
41
  arel (>= 9.0)
42
- activestorage (5.2.0)
43
- actionpack (= 5.2.0)
44
- activerecord (= 5.2.0)
42
+ activestorage (5.2.2)
43
+ actionpack (= 5.2.2)
44
+ activerecord (= 5.2.2)
45
45
  marcel (~> 0.3.1)
46
- activesupport (5.2.0)
46
+ activesupport (5.2.2)
47
47
  concurrent-ruby (~> 1.0, >= 1.0.2)
48
48
  i18n (>= 0.7, < 2)
49
49
  minitest (~> 5.1)
@@ -64,7 +64,7 @@ GEM
64
64
  capybara (>= 2.3, < 4.0)
65
65
  json
66
66
  coderay (1.1.2)
67
- concurrent-ruby (1.0.5)
67
+ concurrent-ruby (1.1.3)
68
68
  crass (1.0.4)
69
69
  diff-lcs (1.3)
70
70
  erubi (1.7.1)
@@ -73,23 +73,23 @@ GEM
73
73
  globalid (0.4.1)
74
74
  activesupport (>= 4.2.0)
75
75
  hpricot (0.8.6)
76
- i18n (1.0.0)
76
+ i18n (1.1.1)
77
77
  concurrent-ruby (~> 1.0)
78
78
  json (2.1.0)
79
- loofah (2.2.2)
79
+ loofah (2.2.3)
80
80
  crass (~> 1.0.2)
81
81
  nokogiri (>= 1.5.9)
82
- mail (2.7.0)
82
+ mail (2.7.1)
83
83
  mini_mime (>= 0.1.1)
84
- marcel (0.3.2)
84
+ marcel (0.3.3)
85
85
  mimemagic (~> 0.3.2)
86
- method_source (0.9.0)
86
+ method_source (0.9.2)
87
87
  mimemagic (0.3.2)
88
- mini_mime (1.0.0)
88
+ mini_mime (1.0.1)
89
89
  mini_portile2 (2.3.0)
90
90
  minitest (5.11.3)
91
- nio4r (2.3.0)
92
- nokogiri (1.8.2)
91
+ nio4r (2.3.1)
92
+ nokogiri (1.8.5)
93
93
  mini_portile2 (~> 2.3.0)
94
94
  onkcop (0.53.0.0)
95
95
  rubocop (~> 0.53.0)
@@ -102,33 +102,33 @@ GEM
102
102
  coderay (~> 1.1.0)
103
103
  method_source (~> 0.9.0)
104
104
  public_suffix (3.0.2)
105
- rack (2.0.4)
106
- rack-test (1.0.0)
105
+ rack (2.0.6)
106
+ rack-test (1.1.0)
107
107
  rack (>= 1.0, < 3)
108
- rails (5.2.0)
109
- actioncable (= 5.2.0)
110
- actionmailer (= 5.2.0)
111
- actionpack (= 5.2.0)
112
- actionview (= 5.2.0)
113
- activejob (= 5.2.0)
114
- activemodel (= 5.2.0)
115
- activerecord (= 5.2.0)
116
- activestorage (= 5.2.0)
117
- activesupport (= 5.2.0)
108
+ rails (5.2.2)
109
+ actioncable (= 5.2.2)
110
+ actionmailer (= 5.2.2)
111
+ actionpack (= 5.2.2)
112
+ actionview (= 5.2.2)
113
+ activejob (= 5.2.2)
114
+ activemodel (= 5.2.2)
115
+ activerecord (= 5.2.2)
116
+ activestorage (= 5.2.2)
117
+ activesupport (= 5.2.2)
118
118
  bundler (>= 1.3.0)
119
- railties (= 5.2.0)
119
+ railties (= 5.2.2)
120
120
  sprockets-rails (>= 2.0.0)
121
121
  rails-dom-testing (2.0.3)
122
122
  activesupport (>= 4.2.0)
123
123
  nokogiri (>= 1.6)
124
124
  rails-html-sanitizer (1.0.4)
125
125
  loofah (~> 2.2, >= 2.2.2)
126
- railties (5.2.0)
127
- actionpack (= 5.2.0)
128
- activesupport (= 5.2.0)
126
+ railties (5.2.2)
127
+ actionpack (= 5.2.2)
128
+ activesupport (= 5.2.2)
129
129
  method_source
130
130
  rake (>= 0.8.7)
131
- thor (>= 0.18.1, < 2.0)
131
+ thor (>= 0.19.0, < 2.0)
132
132
  rainbow (3.0.0)
133
133
  rake (12.3.1)
134
134
  rspec (3.7.0)
@@ -165,7 +165,7 @@ GEM
165
165
  rubocop-rspec (1.25.0)
166
166
  rubocop (>= 0.53.0)
167
167
  ruby-progressbar (1.9.0)
168
- sprockets (3.7.1)
168
+ sprockets (3.7.2)
169
169
  concurrent-ruby (~> 1.0)
170
170
  rack (> 1, < 3)
171
171
  sprockets-rails (3.2.1)
@@ -175,7 +175,7 @@ GEM
175
175
  sqlite3 (1.3.13)
176
176
  sqlite3-ruby (1.3.3)
177
177
  sqlite3 (>= 1.3.3)
178
- thor (0.20.0)
178
+ thor (0.20.3)
179
179
  thread_safe (0.3.6)
180
180
  tzinfo (1.2.5)
181
181
  thread_safe (~> 0.1)
@@ -205,4 +205,4 @@ DEPENDENCIES
205
205
  sqlite3-ruby
206
206
 
207
207
  BUNDLED WITH
208
- 1.16.1
208
+ 1.16.4
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  * 携帯電話のキャリア判別
10
10
  * 端末位置情報の取得
11
- * [GeoKit](http://geokit.rubyforge.org) との連携
11
+ * [GeoKit](https://github.com/geokit/geokit) との連携
12
12
 
13
13
  * 端末製造番号、契約者番号等の取得
14
14
  * IPアドレスの検証(キャリアが公開しているIPアドレス帯域からのアクセスか判定)
@@ -164,7 +164,7 @@ eがincludeされる。したがって、
164
164
  request.mobile.position.distance_to('札幌駅')
165
165
  ```
166
166
 
167
- とすることで、端末と「札幌駅」との距離を求めることができる。詳細は http://geokit.rubyforge.org/api/index.html
167
+ とすることで、端末と「札幌駅」との距離を求めることができる。詳細は https://www.rubydoc.info/github/geokit/geokit/master/frames
168
168
  参照。
169
169
 
170
170
  ### 端末情報の取得
@@ -1,33 +1,28 @@
1
1
  #:stopdoc:
2
2
  # helperを追加
3
- ActionView::Base.class_eval { include Jpmobile::Helpers }
3
+ # ActionView trans_sid を有効にする
4
+ ActionView::Base.class_eval do
5
+ include Jpmobile::Helpers
6
+
7
+ delegate :default_url_options, to: :controller unless respond_to?(:default_url_options)
8
+ end
4
9
  #:startdoc:
5
10
 
6
11
  # :stopdoc:
7
12
  # accept-charset に charset を変更できるようにする
8
- # ActionView で trans_sid を有効にする
9
- module ActionView
10
- module Helpers
11
- module FormTagHelper
13
+ module Jpmobile
14
+ module ActionView
15
+ module HtmlOptionsWithAcceptCharset
12
16
  private
13
17
 
14
18
  def html_options_for_form(url_for_options, options, *parameters_for_url)
15
- accept_charset = (Rails.application.config.jpmobile.form_accept_charset_conversion && request && request.mobile && request.mobile.default_charset) || 'UTF-8'
16
-
17
- options.stringify_keys.tap do |html_options|
18
- html_options['enctype'] = 'multipart/form-data' if html_options.delete('multipart')
19
- # The following URL is unescaped, this is just a hash of options, and it is the
20
- # responsability of the caller to escape all the values.
21
- html_options['action'] = url_for(url_for_options, *parameters_for_url)
22
- html_options['accept-charset'] = accept_charset
23
- html_options['data-remote'] = true if html_options.delete('remote')
19
+ super.tap do |o|
20
+ o['accept-charset'] = (Rails.application.config.jpmobile.form_accept_charset_conversion && request && request.mobile && request.mobile.default_charset) || o['accept-charset']
24
21
  end
25
22
  end
26
23
  end
27
24
  end
28
-
29
- class Base
30
- delegate :default_url_options, to: :controller unless respond_to?(:default_url_options)
31
- end
32
25
  end
26
+
27
+ ::ActionView::Helpers::FormTagHelper.send :prepend, Jpmobile::ActionView::HtmlOptionsWithAcceptCharset
33
28
  #:startdoc:
@@ -7,17 +7,17 @@ module Jpmobile
7
7
 
8
8
  def call(env)
9
9
  # 入力
10
- if (@mobile = env['rack.jpmobile']) && @mobile.apply_params_filter?
10
+ if (mobile = env['rack.jpmobile']) && mobile.apply_params_filter?
11
11
  # パラメータをkey, valueに分解
12
12
  # form_params
13
13
  unless env['REQUEST_METHOD'] == 'GET' || env['REQUEST_METHOD'] == 'HEAD'
14
14
  unless env['CONTENT_TYPE'].match?(%r{application/json|application/xml})
15
- env['rack.input'] = StringIO.new(parse_query(env['rack.input'].read))
15
+ env['rack.input'] = StringIO.new(parse_query(env['rack.input'].read, mobile))
16
16
  end
17
17
  end
18
18
 
19
19
  # query_params
20
- env['QUERY_STRING'] = parse_query(env['QUERY_STRING'])
20
+ env['QUERY_STRING'] = parse_query(env['QUERY_STRING'], mobile)
21
21
  end
22
22
 
23
23
  status, env, body = @app.call(env)
@@ -27,18 +27,18 @@ module Jpmobile
27
27
 
28
28
  private
29
29
 
30
- def to_internal(str)
31
- ::Rack::Utils.escape(@mobile.to_internal(::Rack::Utils.unescape(str)))
30
+ def to_internal(str, mobile)
31
+ ::Rack::Utils.escape(mobile.to_internal(::Rack::Utils.unescape(str)))
32
32
  end
33
33
 
34
- def parse_query(str)
34
+ def parse_query(str, mobile)
35
35
  return nil unless str
36
36
 
37
37
  new_array = []
38
38
  str.split('&').each do |param_pair|
39
39
  k, v = param_pair.split('=')
40
- k = to_internal(k) if k
41
- v = to_internal(v) if v
40
+ k = to_internal(k, mobile) if k
41
+ v = to_internal(v, mobile) if v
42
42
  new_array << "#{k}=#{v}" if k
43
43
  end
44
44
 
@@ -2,7 +2,6 @@ ActiveSupport.on_load(:action_controller) do
2
2
  require 'jpmobile/docomo_guid'
3
3
  require 'jpmobile/filter'
4
4
  require 'jpmobile/helpers'
5
- require 'jpmobile/hook_action_view'
6
5
  require 'jpmobile/trans_sid'
7
6
  require 'jpmobile/hook_test_request'
8
7
  ActionDispatch::Request.send :prepend, Jpmobile::Encoding
@@ -11,6 +10,10 @@ ActiveSupport.on_load(:action_controller) do
11
10
  ActionController::Base.send :prepend, Jpmobile::TransSidRedirecting
12
11
  end
13
12
 
13
+ ActiveSupport.on_load(:action_view) do
14
+ require 'jpmobile/hook_action_view'
15
+ end
16
+
14
17
  ActiveSupport.on_load(:after_initialize) do
15
18
  case Rails.application.config.session_store.to_s
16
19
  when 'ActionDispatch::Session::MemCacheStore'
@@ -1,3 +1,3 @@
1
1
  module Jpmobile
2
- VERSION = '5.2.2'.freeze
2
+ VERSION = '5.2.3'.freeze
3
3
  end
@@ -258,7 +258,7 @@ describe 'Jpmobile::Mail#receive' do
258
258
  end
259
259
 
260
260
  it 'body should be parsed correctly' do
261
- expect(@mail.body.to_s).to eq("本文&#xe522;\nFor au\n\n")
261
+ expect(@mail.body.to_s).to eq("本文&#xe522;\r\nFor au\r\n\r\n")
262
262
  end
263
263
 
264
264
  context 'to_s' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jpmobile
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.2
4
+ version: 5.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shin-ichiro OGAWA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-06-05 00:00:00.000000000 Z
12
+ date: 2019-03-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mail
@@ -172,6 +172,7 @@ executables: []
172
172
  extensions: []
173
173
  extra_rdoc_files: []
174
174
  files:
175
+ - ".circleci/config.yml"
175
176
  - ".gitignore"
176
177
  - ".rspec"
177
178
  - ".rubocop.yml"
@@ -182,7 +183,6 @@ files:
182
183
  - MIT-LICENSE
183
184
  - README.md
184
185
  - Rakefile
185
- - circle.yml
186
186
  - init.rb
187
187
  - jpmobile.gemspec
188
188
  - lib/jpmobile.rb
data/circle.yml DELETED
@@ -1,14 +0,0 @@
1
- machine:
2
- timezone:
3
- Asia/Tokyo
4
- ruby:
5
- version: 2.4.2
6
-
7
- database:
8
- override:
9
- - echo "Skip create database."
10
-
11
- test:
12
- override:
13
- - bundle exec rubocop
14
- - bundle exec rake test