libgss 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTY1Y2NkY2JlMzViNGQ4YzczYTQyMmY1MThiZDFhZDQzOGMwMmY3Nw==
4
+ NWI5MTBmYjkxNGM3OTRjYWZlMzQ5NDYwY2NiZDA5M2ViYmM5Mjc1OQ==
5
5
  data.tar.gz: !binary |-
6
- MzY4M2Q0N2Y3NjRhMmMyYmJjNjM3MzIxNTdhMzY2ZGU0NmViNGQ4NA==
6
+ ZjNiYTE4YWI0NTljNmJjNzcyZDBmOTY1MmU5ZDU2M2FlMTk2NmVhYw==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- MzAxOWExYTUwYjMwOWNhOWQ0ZTVlMjIyMDQyOGI5Y2ExN2E2MzlmYjFmNzdi
10
- MmU3NDgwYTdkZjIwOTJkODc0YTkxM2FmYTIyNGY5OWE1N2RmNWYzNTkyODJj
11
- ZGVjNGE0ZDI3N2RhOTI0NzdmNjVkMzE3MmE2Y2QwNGVjZDVlZDg=
9
+ YzNkMDkxNzIzYzZhNmJkNmQ2MTk2NzYxNWExYzUwYmYxOTBiOWVmNmRkMjkw
10
+ NDg5OWJiZGU4YjJkODc2ZjBkOWU1NWFmYjZiZDQ4ZDgyMTE1NWVjYjRhYjY0
11
+ YmFlNDM0MDBmMWFiYmI1Mjg0NmFiMDZhNGM4YzFkMGM2ZjE2YTA=
12
12
  data.tar.gz: !binary |-
13
- NjczMGQzZDI3ZTkwZDkyMzkwMGZjOWRjNTBlNDRkNGJkNDRjNzliNGJmZDI2
14
- NTYyYmM2NzRiMTc0YWM2NGY0Mzc1MjVhOWQwZDAzOTQ5NzNlZTYwMjY1ZTRl
15
- NDI1NjYwNjA4MDUzZjFiOTJjNGRkOWVmZWNiMTljYzU3YzdlNGE=
13
+ ZDE4MDBmNGI1MzFjNzdjZTI5OTc1MDA0NGQ4ZDkzODA4OTBhOTllNDhmOGNm
14
+ MTVlYWNlN2RmNzYwMjBlMDk5OTIzNWYxY2FiZmRiZTNiZjBiMTdkNDgxOTNl
15
+ ODU2MWFjNDVjOTRmMzZhNGE3ZDA4MjQ4MThmZDRiYzAyY2FiMTQ=
data/README.md CHANGED
@@ -22,26 +22,45 @@ Or install it yourself as:
22
22
 
23
23
  ## Usage
24
24
 
25
- $ irb -r libgss
26
-
27
- >> network = Libgss::Network.new("http://localhost:3000", ssl_disabled: true)
28
- => #<Libgss::Network:2152782140 @ssl_disabled=true, @base_url="http://localhost:3000", @ssl_base_url="http://localhost:3000", @platform="fontana">
29
- >> network.player_id = "1000001"
30
- => "1000001"
31
- >> network.login
32
- => true
33
- >>
34
- ?> req1 = network.new_action_request
35
- => #<Libgss::ActionRequest:2152568320 @action_url="http://localhost:3000/api/1.0.0/actions.json?auth_token=259rKDuSb3CT1UxbywAf", @status=0, @actions=[], @action_id=0>
36
- >> req1.execute("ItemRubyStoredScript", "use_item", {"item_cd" => "20001"})
37
- => #<Libgss::Action:0x0000010092f7b0 @id=1, @args={:action=>"execute", :name=>"ItemRubyStoredScript", :key=>"use_item", :args=>{"item_cd"=>"20001"}}>
38
- >> req1.get_by_game_data
39
- => #<Libgss::Action:0x000001008f9188 @id=2, @args={:action=>"get", :name=>"GameData"}>
40
- >> req1.send_request
41
- => nil
42
- >>
43
- ?> req1.outputs
44
- => [{"result"=>"You don't have enough item", "id"=>1}, {"result"=>{"content"=>{"hp"=>15, "max_hp"=>15, "mp"=>5, "max_mp"=>5, "exp"=>100, "money"=>200, "items"=>{"20001"=>0, "20005"=>1}, "equipments"=>{"head"=>10018, "body"=>10012, "right_hand"=>10001, "left_hand"=>nil}}, "greeting_points"=>0, "login_bonus"=>[[10001, 1]], "invitation_code"=>nil, "invite_player"=>nil, "read_notifications"=>[]}, "id"=>2}]
45
- >>
46
- ?> req1.outputs.get(1)
47
- => {"result"=>"You don't have enough item", "id"=>1}
25
+ ```
26
+ $ irb -r libgss
27
+
28
+ >> network = Libgss::Network.new("http://localhost:3000", ssl_disabled: true)
29
+ => #<Libgss::Network:2152782140 @ssl_disabled=true, @base_url="http://localhost:3000", @ssl_base_url="http://localhost:3000", @platform="fontana">
30
+ >> network.player_id = "1000001"
31
+ => "1000001"
32
+ >> network.login
33
+ => true
34
+ >>
35
+ ?> req1 = network.new_action_request
36
+ => #<Libgss::ActionRequest:2152568320 @action_url="http://localhost:3000/api/1.0.0/actions.json?auth_token=259rKDuSb3CT1UxbywAf", @status=0, @actions=[], @action_id=0>
37
+ >> req1.execute("ItemRubyStoredScript", "use_item", {"item_cd" => "20001"})
38
+ => #<Libgss::Action:0x0000010092f7b0 @id=1, @args={:action=>"execute", :name=>"ItemRubyStoredScript", :key=>"use_item", :args=>{"item_cd"=>"20001"}}>
39
+ >> req1.get_by_game_data
40
+ => #<Libgss::Action:0x000001008f9188 @id=2, @args={:action=>"get", :name=>"GameData"}>
41
+ >> req1.send_request
42
+ => nil
43
+ >>
44
+ ?> req1.outputs
45
+ => [{"result"=>"You don't have enough item", "id"=>1}, {"result"=>{"content"=>{"hp"=>15, "max_hp"=>15, "mp"=>5, "max_mp"=>5, "exp"=>100, "money"=>200, "items"=>{"20001"=>0, "20005"=>1}, "equipments"=>{"head"=>10018, "body"=>10012, "right_hand"=>10001, "left_hand"=>nil}}, "greeting_points"=>0, "login_bonus"=>[[10001, 1]], "invitation_code"=>nil, "invite_player"=>nil, "read_notifications"=>[]}, "id"=>2}]
46
+ >>
47
+ ?> req1.outputs.get(1)
48
+ => {"result"=>"You don't have enough item", "id"=>1}
49
+ ```
50
+
51
+
52
+ ## connection testing
53
+
54
+ You can use `gss-server-time` command to test connection like this:
55
+
56
+ ```
57
+ $ gss-server-time http://localhost:3000 -a path/to/app_garden.yml.erb
58
+ ```
59
+
60
+ or
61
+
62
+ ```
63
+ $ gss-server-time http://localhost:3000 -p fontana -c <consumer_secret> -i <player_id>
64
+ ```
65
+
66
+ see `gss-server-time --help` for more options
data/README_ja.md CHANGED
@@ -30,32 +30,50 @@ libgss-rubyはGroovenautsのGSS用通信ライブラリです。
30
30
 
31
31
  手動で以下のコマンドを実行してインストールできます:
32
32
 
33
- $ gem install libgss
33
+ ```
34
+ $ gem install libgss
35
+ ```
34
36
 
35
37
  ## irbでの使用方法
36
38
 
37
- $ irb -r libgss
38
-
39
- >> network = Libgss::Network.new("http://localhost:3000", ssl_disabled: true)
40
- => #<Libgss::Network:2152782140 @ssl_disabled=true, @base_url="http://localhost:3000", @ssl_base_url="http://localhost:3000", @platform="fontana">
41
- >> network.player_id = "1000001"
42
- => "1000001"
43
- >> network.login
44
- => true
45
- >>
46
- ?> req1 = network.new_action_request
47
- => #<Libgss::ActionRequest:2152568320 @action_url="http://localhost:3000/api/1.0.0/actions.json?auth_token=259rKDuSb3CT1UxbywAf", @status=0, @actions=[], @action_id=0>
48
- >> req1.execute("ItemRubyStoredScript", "use_item", {"item_cd" => "20001"})
49
- => #<Libgss::Action:0x0000010092f7b0 @id=1, @args={:action=>"execute", :name=>"ItemRubyStoredScript", :key=>"use_item", :args=>{"item_cd"=>"20001"}}>
50
- >> req1.get_by_game_data
51
- => #<Libgss::Action:0x000001008f9188 @id=2, @args={:action=>"get", :name=>"GameData"}>
52
- >> req1.send_request
53
- => nil
54
- >>
55
- ?> req1.outputs
56
- => [{"result"=>"You don't have enough item", "id"=>1}, {"result"=>{"content"=>{"hp"=>15, "max_hp"=>15, "mp"=>5, "max_mp"=>5, "exp"=>100, "money"=>200, "items"=>{"20001"=>0, "20005"=>1}, "equipments"=>{"head"=>10018, "body"=>10012, "right_hand"=>10001, "left_hand"=>nil}}, "greeting_points"=>0, "login_bonus"=>[[10001, 1]], "invitation_code"=>nil, "invite_player"=>nil, "read_notifications"=>[]}, "id"=>2}]
57
- >>
58
- ?> req1.outputs.get(1)
59
- => {"result"=>"You don't have enough item", "id"=>1}
60
-
61
-
39
+ ```
40
+ $ irb -r libgss
41
+
42
+ >> network = Libgss::Network.new("http://localhost:3000", ssl_disabled: true)
43
+ => #<Libgss::Network:2152782140 @ssl_disabled=true, @base_url="http://localhost:3000", @ssl_base_url="http://localhost:3000", @platform="fontana">
44
+ >> network.player_id = "1000001"
45
+ => "1000001"
46
+ >> network.login
47
+ => true
48
+ >>
49
+ ?> req1 = network.new_action_request
50
+ => #<Libgss::ActionRequest:2152568320 @action_url="http://localhost:3000/api/1.0.0/actions.json?auth_token=259rKDuSb3CT1UxbywAf", @status=0, @actions=[], @action_id=0>
51
+ >> req1.execute("ItemRubyStoredScript", "use_item", {"item_cd" => "20001"})
52
+ => #<Libgss::Action:0x0000010092f7b0 @id=1, @args={:action=>"execute", :name=>"ItemRubyStoredScript", :key=>"use_item", :args=>{"item_cd"=>"20001"}}>
53
+ >> req1.get_by_game_data
54
+ => #<Libgss::Action:0x000001008f9188 @id=2, @args={:action=>"get", :name=>"GameData"}>
55
+ >> req1.send_request
56
+ => nil
57
+ >>
58
+ ?> req1.outputs
59
+ => [{"result"=>"You don't have enough item", "id"=>1}, {"result"=>{"content"=>{"hp"=>15, "max_hp"=>15, "mp"=>5, "max_mp"=>5, "exp"=>100, "money"=>200, "items"=>{"20001"=>0, "20005"=>1}, "equipments"=>{"head"=>10018, "body"=>10012, "right_hand"=>10001, "left_hand"=>nil}}, "greeting_points"=>0, "login_bonus"=>[[10001, 1]], "invitation_code"=>nil, "invite_player"=>nil, "read_notifications"=>[]}, "id"=>2}]
60
+ >>
61
+ ?> req1.outputs.get(1)
62
+ => {"result"=>"You don't have enough item", "id"=>1}
63
+ ```
64
+
65
+ ## 接続確認
66
+
67
+ 上記のirbでの接続テストを1コマンドで実行できるように`gss-server-time`コマンドを用意しています。
68
+
69
+ ```
70
+ $ gss-server-time http://localhost:3000 -a path/to/app_garden.yml.erb
71
+ ```
72
+
73
+ あるいは
74
+
75
+ ```
76
+ $ gss-server-time http://localhost:3000 -p fontana -c <consumer_secret> -i <player_id>
77
+ ```
78
+
79
+ という風に使用します。詳しくは `gss-server-time --help` を参照してください。
@@ -33,6 +33,15 @@ module Libgss
33
33
  TEST_HTTP_PORT = 3000
34
34
  TEST_HTTPS_PORT = 3001
35
35
 
36
+ # Libgss::Networkのコンストラクタです。
37
+ #
38
+ # @param [String] base_url_or_host 接続先の基準となるURLあるいはホスト名
39
+ # @param [Hash] options オプション
40
+ # @option options [String] :platform 接続先のGSSサーバの認証のプラットフォーム。デフォルトは"fontana"。
41
+ # @option options [String] :player_id 接続に使用するプレイヤのID
42
+ # @option options [String] :consumer_secret GSSサーバとクライアントの間で行う署名の検証に使用される文字列。
43
+ # @option options [Boolean] :ssl_disabled SSLを無効にするかどうか。
44
+ # @option options [Boolean] :ignore_signature_key シグネチャキーによる署名を行うかどうか
36
45
  def initialize(base_url_or_host, options = {})
37
46
  @ssl_disabled = options.delete(:ssl_disabled)
38
47
  if base_url_or_host =~ URI.regexp
@@ -61,6 +70,13 @@ module Libgss
61
70
  r << fields.join(", ") << ">"
62
71
  end
63
72
 
73
+
74
+ # GSSサーバに接続してログインの検証と処理を行います。
75
+ #
76
+ # @param [String] base_url_or_host 接続先の基準となるURLあるいはホスト名
77
+ # @param [Hash] options オプション
78
+ # @option options [String] :platform 接続先のGSSサーバの認証のプラットフォーム。デフォルトは"fontana"。
79
+ # @return [Boolean] ログインに成功した場合はtrue、失敗した場合はfalse
64
80
  def login(extra = {})
65
81
  attrs = { "player[id]" => player_id }
66
82
  extra.each{|k, v| attrs[ "player[#{k}]" ] = v }
@@ -1,3 +1,3 @@
1
1
  module Libgss
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
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.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - akima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-11 00:00:00.000000000 Z
11
+ date: 2013-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler