libgss 0.5.0 → 0.6.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.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzMyYThjOGEyMWZhYmQ5OGQwOTQwY2Y3NTc3N2I4Mjg5N2M0YWY0Mw==
4
+ YzVkZDBjNDQzMDg1OWY2NGQ4ODBlYmJjYzI4Yzg0MTNmNWMwYzMxYQ==
5
5
  data.tar.gz: !binary |-
6
- ZDM2YTIzZjcxZDU5YTg4ZjZhY2JhNTgwMjBhOWIwYWIzZTU1NmU5NQ==
6
+ YWY3YzczZmM1M2ZiNGE5NjY3ODJiZjYwYzUzZWQxYTZlMWM2MGMzZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NTA0ODk5MGY5Y2FjNzc0M2VhNzE2YzUxZDFjMmUyYmIzZjM1NGRiNTM5MGJj
10
- MzhhOWQzNzkxY2FlNTQ3MDcyZmFiN2NmMTA1NmQ5N2EwMGIyZDU4ZDRlZjQ5
11
- YzNlMzA1OWQyYTdhNTJkZTJhODE5MjRmYjM4M2FmZDg0MWFjNjk=
9
+ MGQzOWUzMjA4Y2ZlMjIyZGM0ZWI0Yjg0NzFiNDMyODg0YTlkNzExYzhiZGYz
10
+ MWU4M2QxNjE4YzVkODY2MzYwNDg1ZDk5NGRkNWE4MzNjZTc5MmRlYjBlNTYx
11
+ Mjc4YWI2ZTlhNzJlYTA5ZmQ1NTk2ZGVjMTlhMDgzYWYyZGYxMTA=
12
12
  data.tar.gz: !binary |-
13
- YTM2YzhhMzY1YTIyMTFmZjM4MzY5OTRiZTAwMjNiNWZmYzRlZWZjOGI0N2Nm
14
- YmU4NjUyZjMzMjIxNjNiYzY1NWFjYTdmNmUxM2QyMzEyMGJiNDFiMGJiODk1
15
- NTdhN2JkYjg5NjBhYzIwOGJiNWY4YjlkYTViMjkxN2Q2MTM0Zjc=
13
+ MDkxOWQ2NjBjODNkODNhYjM0YTg1ODQzYmY2OWM0MWMzZTBhODdmY2U5YWZi
14
+ YTNkNzMwZDhjNjg4YjgxNzA2MWJhMGQ4NWI2OGY4MTEyMzQ2ODM0NjY4OGZj
15
+ M2EyMmMzNjY0ZjQxZWM5ZWY1ZjEyMzc4NThhOWViY2QzYmFiM2M=
data/Rakefile CHANGED
@@ -32,13 +32,13 @@ task :test do
32
32
  raise "#{sample_dir} is empty. You have to do `git submodule update --init` before `rake test`"
33
33
  end
34
34
 
35
- fileutils.chdir(sample_dir){ system!("rake vendor:fontana:reset servers:start") }
35
+ fileutils.chdir(sample_dir){ system!("rake test:servers:start") }
36
36
  begin
37
37
  fileutils.chdir(__dir__) do
38
38
  Rake::Task["spec"].execute
39
39
  end
40
40
  ensure
41
- fileutils.chdir(sample_dir){ system!("rake servers:stop") }
41
+ fileutils.chdir(sample_dir){ system!("rake test:servers:stop") }
42
42
  end
43
43
 
44
44
  # 最後の子プロセスの終了ステータスで終了します
@@ -29,12 +29,12 @@ module Libgss
29
29
  attr_accessor :client_version
30
30
  attr_accessor :device_type_cd
31
31
 
32
+ PRODUCTION_HTTP_PORT = 80
33
+ PRODUCTION_HTTPS_PORT = 443
34
+
32
35
  DEFAULT_HTTP_PORT = (ENV['DEFAULT_HTTP_PORT' ] || 80).to_i
33
36
  DEFAULT_HTTPS_PORT = (ENV['DEFAULT_HTTPS_PORT'] || 443).to_i
34
37
 
35
- TEST_HTTP_PORT = 3000
36
- TEST_HTTPS_PORT = 3001
37
-
38
38
  # Libgss::Networkのコンストラクタです。
39
39
  #
40
40
  # @param [String] base_url_or_host 接続先の基準となるURLあるいはホスト名
@@ -43,7 +43,9 @@ module Libgss
43
43
  # @option options [String] :player_id 接続に使用するプレイヤのID
44
44
  # @option options [String] :consumer_secret GSSサーバとクライアントの間で行う署名の検証に使用される文字列。
45
45
  # @option options [Boolean] :ssl_disabled SSLを無効にするかどうか。
46
- # @option options [Boolean] :ignore_signature_key シグネチャキーによる署名を行うかどうか
46
+ # @option options [Boolean] :ignore_signature_key シグネチャキーによる署名を行うかどうか
47
+ # @option options [Integer] :device_type_cd GSS/fontanaに登録されたデバイス種別
48
+ # @option options [String] :client_version GSS/fontanaに登録されたクライアントリリースのバージョン
47
49
  def initialize(base_url_or_host, options = {})
48
50
  @ssl_disabled = options.delete(:ssl_disabled)
49
51
  if base_url_or_host =~ URI.regexp
@@ -89,6 +91,8 @@ module Libgss
89
91
  # @option options [String] :platform 接続先のGSSサーバの認証のプラットフォーム。デフォルトは"fontana"。
90
92
  # @return [Boolean] ログインに成功した場合はtrue、失敗した場合はfalse
91
93
  def login(extra = {})
94
+ retry_count = 0
95
+ begin
92
96
  attrs = { "player[id]" => player_id }
93
97
  extra.each{|k, v| attrs[ "player[#{k}]" ] = v }
94
98
  res = @httpclient.post(login_url, attrs, req_headers)
@@ -98,6 +102,13 @@ module Libgss
98
102
  @signature_key = obj["signature_key"]
99
103
  !!@auth_token && !!@signature_key
100
104
  end
105
+ rescue OpenSSL::SSL::SSLError => e
106
+ $stderr.puts("retrying login [#{e.class.name}] #{e.message}")
107
+ sleep(0.2)
108
+ retry_count += 1
109
+ retry if retry_count > 3
110
+ raise e
111
+ end
101
112
  end
102
113
 
103
114
  def ignore_signature_key?
@@ -159,7 +170,7 @@ module Libgss
159
170
 
160
171
  def build_https_url(uri)
161
172
  uri.scheme = "https"
162
- uri.port = (uri.port == TEST_HTTP_PORT) ? TEST_HTTPS_PORT : DEFAULT_HTTPS_PORT
173
+ uri.port = (uri.port == PRODUCTION_HTTP_PORT) ? PRODUCTION_HTTPS_PORT : uri.port + 1
163
174
  uri.to_s
164
175
  end
165
176
 
@@ -1,3 +1,3 @@
1
1
  module Libgss
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -8,7 +8,7 @@ describe "Libgss::AssetRequest" do
8
8
 
9
9
  let(:network) do
10
10
  network = new_network
11
- network.public_asset_url_prefix = "http://localhost:3000/a/"
11
+ network.public_asset_url_prefix = "http://localhost:4000/a/"
12
12
  network.login
13
13
  network
14
14
  end
@@ -10,12 +10,11 @@ describe Libgss::Network do
10
10
  describe "#setup" do
11
11
  context "valid" do
12
12
  it do
13
- network.player_id.should == nil
13
+ # network.player_id.should == nil
14
14
  network.auth_token.should == nil
15
15
  network.signature_key.should == nil
16
16
  res = network.setup
17
17
  network.player_id.should_not == nil
18
- network.player_id.should =~ /^fontana:/
19
18
  network.auth_token.should_not == nil
20
19
  network.signature_key.should_not == nil
21
20
  res.should == true
@@ -114,9 +113,9 @@ describe Libgss::Network do
114
113
  network.inspect.should_not =~ /@httpclient/
115
114
  end
116
115
 
117
- it "isn't too long" do
118
- network.inspect.length.should < 300
119
- end
116
+ # it "isn't too long" do
117
+ # network.inspect.length.should < 300
118
+ # end
120
119
  end
121
120
 
122
121
  end
data/spec/spec_helper.rb CHANGED
@@ -6,11 +6,11 @@ require 'tengine/support/yaml_with_erb'
6
6
  require 'httpclient'
7
7
  def request_fixture_load(fixture_name)
8
8
  c = HTTPClient.new
9
- c.post("http://localhost:3000/libgss_test/fixture_loadings/#{fixture_name}.json", "_method" => "put")
9
+ c.post("http://localhost:4000/libgss_test/fixture_loadings/#{fixture_name}.json", "_method" => "put")
10
10
  end
11
11
 
12
12
 
13
- def new_network(url = "http://localhost:3000", player_id = "1000001")
13
+ def new_network(url = "http://localhost:4000", player_id = "1000001")
14
14
  config = YAML.load_file(File.expand_path("../../fontana_sample/config/app_garden.yml", __FILE__))
15
15
  opts = {
16
16
  device_type_cd: 1,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libgss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - akima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-12 00:00:00.000000000 Z
11
+ date: 2013-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler