galakei 0.7.3 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- galakei (0.7.2)
4
+ galakei (0.7.3)
5
5
  actionpack (>= 3.0.3)
6
6
  css_parser
7
7
  nokogiri
@@ -34,6 +34,16 @@ module Galakei
34
34
  def galakei?
35
35
  docomo? || au? || softbank?
36
36
  end
37
+
38
+ def galakei_uid
39
+ if docomo?
40
+ env["HTTP_X_DCMGUID"]
41
+ elsif au?
42
+ env["HTTP_X_UP_SUBNO"]
43
+ elsif softbank?
44
+ env["HTTP_X_JPHONE_UID"]
45
+ end
46
+ end
37
47
  end
38
48
  end
39
49
 
@@ -1,3 +1,3 @@
1
1
  module Galakei
2
- VERSION = "0.7.3"
2
+ VERSION = "0.8.0"
3
3
  end
@@ -16,47 +16,53 @@ end
16
16
 
17
17
  describe Galakei::Request do
18
18
  describe "from Firefox" do
19
- before { @request = Rack::Request.new(env_for("Firefox")) }
19
+ before { @request = Rack::Request.new(env_for_firefox) }
20
20
  it_should_behave_like "non-au devices"
21
21
  it_should_behave_like "non-docomo devices"
22
22
  it_should_behave_like "non-softbank devices"
23
23
  it("should not be galakei") { @request.should_not be_galakei }
24
+ it { @request.galakei_uid.should be_nil }
24
25
  end
25
26
 
26
27
  describe "from Docomo SH-06A" do
27
- before { @request = Rack::Request.new(env_for("Docomo SH-06A")) }
28
+ before { @request = Rack::Request.new(env_for_docomo_1_0) }
28
29
  it_should_behave_like "docomo devices"
29
30
  it_should_behave_like "non-au devices"
30
31
  it_should_behave_like "non-softbank devices"
32
+ it { @request.galakei_uid.should == "0000002" }
31
33
  end
32
34
 
33
35
  describe "from AU W51SH" do
34
- before { @request = Rack::Request.new(env_for("AU W51SH")) }
36
+ before { @request = Rack::Request.new(env_for_au_6_2) }
35
37
  it_should_behave_like "non-docomo devices"
36
38
  it_should_behave_like "non-softbank devices"
37
39
  it_should_behave_like "au devices"
38
40
  it("should be browser 6") { @request.should be_au_browser_6 }
41
+ it { @request.galakei_uid.should == "1234567890_ve.ezweb.ne.jp" }
39
42
  end
40
43
 
41
44
  describe "from AU W54SH" do
42
- before { @request = Rack::Request.new(env_for("AU W54SA")) }
45
+ before { @request = Rack::Request.new(env_for_au_7_2) }
43
46
  it_should_behave_like "non-docomo devices"
44
47
  it_should_behave_like "non-softbank devices"
45
48
  it_should_behave_like "au devices"
46
49
  it("should not be browser 6") { @request.should_not be_au_browser_6 }
50
+ it { @request.galakei_uid.should == "1234567890_ve.ezweb.ne.jp" }
47
51
  end
48
52
 
49
- describe "from Vodafone 802N" do
50
- before { @request = Rack::Request.new(env_for("Vodafone 802N")) }
53
+ describe "from Vodafone" do
54
+ before { @request = Rack::Request.new(env_for_vodafone) }
51
55
  it_should_behave_like "non-au devices"
52
56
  it_should_behave_like "non-docomo devices"
53
57
  it_should_behave_like "softbank devices"
58
+ it { @request.galakei_uid.should == "11111111msimmsim" }
54
59
  end
55
60
 
56
61
  describe "from Softbank 709SC" do
57
- before { @request = Rack::Request.new(env_for("Softbank 709SC")) }
62
+ before { @request = Rack::Request.new(env_for_softbank) }
58
63
  it_should_behave_like "non-au devices"
59
64
  it_should_behave_like "non-docomo devices"
60
65
  it_should_behave_like "softbank devices"
66
+ it { @request.galakei_uid.should == "11111111msimmsim" }
61
67
  end
62
68
  end
data/spec/spec_helper.rb CHANGED
@@ -4,14 +4,31 @@ require 'galakei'
4
4
  require File.expand_path(File.dirname(__FILE__) + "/app/fake")
5
5
  require 'rspec/rails'
6
6
 
7
- def env_for(device_name)
8
- user_agent = {
9
- "Firefox" => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.16) Gecko/20101130 Firefox/3.5.16",
10
- "Docomo SH-06A" => "DoCoMo/2.0 SH06A3(c500;TB;W24H14)" ,
11
- "AU W51SH" => "KDDI-SH32 UP.Browser/6.2.0.11.2.1 (GUI) MMP/2.0",
12
- "AU W54SA" => "KDDI-SA3B UP.Browser/6.2_7.2.7.1.K.1.3.101 (GUI) MMP/2.0",
13
- "Vodafone 802N" => "Vodafone/1.0/V802N/NJ001/SN*************** Browser/UP.Browser/7.0.2.1.307 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0",
14
- "Softbank 709SC" => "SoftBank/1.0/709SC/SCJ001/SN*************** Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1"
15
- }[device_name]
16
- { "HTTP_USER_AGENT" => user_agent }
7
+ def env_for_firefox
8
+ { "HTTP_USER_AGENT" => "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.16) Gecko/20101130 Firefox/3.5.16" }
9
+ end
10
+
11
+ def env_for_docomo_1_0
12
+ { "HTTP_USER_AGENT" => "DoCoMo/2.0 SH06A3(c500;TB;W24H14)",
13
+ "HTTP_X_DCMGUID" => "0000002" }
14
+ end
15
+
16
+ def env_for_au_6_2
17
+ { "HTTP_USER_AGENT" => "KDDI-SH32 UP.Browser/6.2.0.11.2.1 (GUI) MMP/2.0",
18
+ "HTTP_X_UP_SUBNO" => "1234567890_ve.ezweb.ne.jp" }
19
+ end
20
+
21
+ def env_for_au_7_2
22
+ { "HTTP_USER_AGENT" => "KDDI-SA3B UP.Browser/6.2_7.2.7.1.K.1.3.101 (GUI) MMP/2.0",
23
+ "HTTP_X_UP_SUBNO" => "1234567890_ve.ezweb.ne.jp" }
24
+ end
25
+
26
+ def env_for_vodafone
27
+ { "HTTP_USER_AGENT" => "Vodafone/1.0/V802N/NJ001/SN*************** Browser/UP.Browser/7.0.2.1.307 Profile/MIDP-2.0 Configuration/CLDC-1.1 Ext-J-Profile/JSCL-1.2.2 Ext-V-Profile/VSCL-2.0.0",
28
+ "HTTP_X_JPHONE_UID" => "11111111msimmsim" }
29
+ end
30
+
31
+ def env_for_softbank
32
+ { "HTTP_USER_AGENT" => "SoftBank/1.0/709SC/SCJ001/SN*************** Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1",
33
+ "HTTP_X_JPHONE_UID" => "11111111msimmsim" }
17
34
  end
metadata CHANGED
@@ -1,8 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: galakei
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.7.3
4
+ hash: 63
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 8
9
+ - 0
10
+ version: 0.8.0
6
11
  platform: ruby
7
12
  authors:
8
13
  - Paul McMahon
@@ -12,7 +17,8 @@ autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
19
 
15
- date: 2011-07-27 00:00:00 Z
20
+ date: 2011-08-17 00:00:00 +09:00
21
+ default_executable:
16
22
  dependencies:
17
23
  - !ruby/object:Gem::Dependency
18
24
  name: actionpack
@@ -22,6 +28,11 @@ dependencies:
22
28
  requirements:
23
29
  - - ">="
24
30
  - !ruby/object:Gem::Version
31
+ hash: 1
32
+ segments:
33
+ - 3
34
+ - 0
35
+ - 3
25
36
  version: 3.0.3
26
37
  type: :runtime
27
38
  version_requirements: *id001
@@ -33,6 +44,11 @@ dependencies:
33
44
  requirements:
34
45
  - - ">="
35
46
  - !ruby/object:Gem::Version
47
+ hash: 29
48
+ segments:
49
+ - 1
50
+ - 2
51
+ - 1
36
52
  version: 1.2.1
37
53
  type: :runtime
38
54
  version_requirements: *id002
@@ -44,6 +60,9 @@ dependencies:
44
60
  requirements:
45
61
  - - ">="
46
62
  - !ruby/object:Gem::Version
63
+ hash: 3
64
+ segments:
65
+ - 0
47
66
  version: "0"
48
67
  type: :runtime
49
68
  version_requirements: *id003
@@ -55,6 +74,9 @@ dependencies:
55
74
  requirements:
56
75
  - - ">="
57
76
  - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
58
80
  version: "0"
59
81
  type: :runtime
60
82
  version_requirements: *id004
@@ -127,6 +149,7 @@ files:
127
149
  - spec/galakei/request_spec.rb
128
150
  - spec/galakei/spacer_spec.rb
129
151
  - spec/spec_helper.rb
152
+ has_rdoc: true
130
153
  homepage: http://www.mobalean.com
131
154
  licenses: []
132
155
 
@@ -140,17 +163,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
140
163
  requirements:
141
164
  - - ">="
142
165
  - !ruby/object:Gem::Version
166
+ hash: 3
167
+ segments:
168
+ - 0
143
169
  version: "0"
144
170
  required_rubygems_version: !ruby/object:Gem::Requirement
145
171
  none: false
146
172
  requirements:
147
173
  - - ">="
148
174
  - !ruby/object:Gem::Version
175
+ hash: 3
176
+ segments:
177
+ - 0
149
178
  version: "0"
150
179
  requirements: []
151
180
 
152
181
  rubyforge_project: galakei
153
- rubygems_version: 1.8.5
182
+ rubygems_version: 1.3.7
154
183
  signing_key:
155
184
  specification_version: 3
156
185
  summary: Japanese feature phones support