gs2-ruby-sdk-realtime 0.0.1

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c9f1adbf36a8ee5b48ca7cf72bc25bbfe7a13f5f
4
+ data.tar.gz: 5ea684f5751d97810cef1ea1ecd828d5d6aa6145
5
+ SHA512:
6
+ metadata.gz: 5d49d6b491ebf4421182b6a06db3a7277fcc8347995cecd1d7f92f5155e8afa323bb55026ad0dfd3a74d9022311cc3c26c179a5cf6e9936838c5852e45b07450
7
+ data.tar.gz: dc9ece8c61dea37c75621ab55a1216152ae507606c5db140788275bf68f10798c7589b4dd4d0a4b63815972659e71244a483f60de4bc47edb8f6ab0f21c3cd9f
data/.buildpath ADDED
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <buildpath>
3
+ <buildpathentry kind="src" path="lib"/>
4
+ <buildpathentry kind="con" path="org.eclipse.dltk.launching.INTERPRETER_CONTAINER"/>
5
+ </buildpath>
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ .DS_Store
data/.project ADDED
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>gs2-ruby-sdk-realtime</name>
4
+ <comment></comment>
5
+ <projects>
6
+ </projects>
7
+ <buildSpec>
8
+ <buildCommand>
9
+ <name>org.eclipse.dltk.core.scriptbuilder</name>
10
+ <arguments>
11
+ </arguments>
12
+ </buildCommand>
13
+ </buildSpec>
14
+ <natures>
15
+ <nature>org.eclipse.dltk.ruby.core.nature</nature>
16
+ </natures>
17
+ </projectDescription>
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+ gem 'test-unit', '3.1.0'
5
+ gem "simplecov", "~> 0.11"
data/README.md ADDED
@@ -0,0 +1,2 @@
1
+ gs2-ruby-sdk-realtime
2
+ ===============
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gs2/sdk/for/ruby/realtime"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gs2/realtime/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gs2-ruby-sdk-realtime"
8
+ spec.version = Gs2::Realtime::VERSION
9
+ spec.authors = ["Game Server Services, Inc."]
10
+ spec.email = ["contact@gs2.io"]
11
+ spec.licenses = "Apache-2.0"
12
+
13
+ spec.summary = %q{Game Server Services GS2-Realtime Client Library}
14
+ spec.homepage = "https://gs2.io/"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "gs2-ruby-sdk-core", "~> 0.0.1"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.12"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ end
@@ -0,0 +1,284 @@
1
+ require 'gs2/core/AbstractClient.rb'
2
+
3
+ module Gs2 module Realtime
4
+
5
+ # GS2-Realtime クライアント
6
+ #
7
+ # @author Game Server Services, Inc.
8
+ class Client < Gs2::Core::AbstractClient
9
+
10
+ @@ENDPOINT = 'realtime'
11
+
12
+ # コンストラクタ
13
+ #
14
+ # @param region [String] リージョン名
15
+ # @param gs2_client_id [String] GSIクライアントID
16
+ # @param gs2_client_secret [String] GSIクライアントシークレット
17
+ def initialize(region, gs2_client_id, gs2_client_secret)
18
+ super(region, gs2_client_id, gs2_client_secret)
19
+ end
20
+
21
+ # デバッグ用。通常利用する必要はありません。
22
+ def self.ENDPOINT(v = nil)
23
+ if v
24
+ @@ENDPOINT = v
25
+ else
26
+ return @@ENDPOINT
27
+ end
28
+ end
29
+
30
+ # ギャザリングプールリストを取得
31
+ #
32
+ # @param pageToken [String] ページトークン
33
+ # @param limit [Integer] 取得件数
34
+ # @return [Array]
35
+ # * items
36
+ # [Array]
37
+ # * gatheringPoolId => ギャザリングプールID
38
+ # * ownerId => オーナーID
39
+ # * name => ギャザリングプール名
40
+ # * description => 説明文
41
+ # * createAt => 作成日時
42
+ # * nextPageToken => 次ページトークン
43
+ def describe_gathering_pool(pageToken = nil, limit = nil)
44
+ query = {}
45
+ if pageToken; query['pageToken'] = pageToken; end
46
+ if limit; query['limit'] = limit; end
47
+ return get(
48
+ 'Gs2Realtime',
49
+ 'DescribeGatheringPool',
50
+ @@ENDPOINT,
51
+ '/gatheringPool',
52
+ query);
53
+ end
54
+
55
+ # ギャザリングプールを作成<br>
56
+ # <br>
57
+ # GS2-Realtime を利用するには、まずギャザリングプールを作成する必要があります。<br>
58
+ # ギャザリングプールには複数のギャザリングを紐付けることができます。<br>
59
+ #
60
+ # @param request [Array]
61
+ # * name => マッチメイキング名
62
+ # * description => 説明文
63
+ # @return [Array]
64
+ # * item
65
+ # * gatheringPoolId => ギャザリングプールID
66
+ # * ownerId => オーナーID
67
+ # * name => ギャザリングプール名
68
+ # * description => 説明文
69
+ # * createAt => 作成日時
70
+ def create_gathering_pool(request)
71
+ if not request; raise ArgumentError.new(); end
72
+ body = {}
73
+ if request.has_key?('name'); body['name'] = request['name']; end
74
+ if request.has_key?('description'); body['description'] = request['description']; end
75
+ query = {}
76
+ return post(
77
+ 'Gs2Realtime',
78
+ 'CreateGatheringPool',
79
+ @@ENDPOINT,
80
+ '/gatheringPool',
81
+ body,
82
+ query);
83
+ end
84
+
85
+ # ギャザリングプールを取得
86
+ #
87
+ # @param request [Array]
88
+ # * gatheringPoolName => ギャザリングプール名
89
+ # @return [Array]
90
+ # * item
91
+ # * gatheringPoolId => ギャザリングプールID
92
+ # * ownerId => オーナーID
93
+ # * name => ギャザリングプール名
94
+ # * description => 説明文
95
+ # * createAt => 作成日時
96
+ def get_gathering_pool(request)
97
+ if not request; raise ArgumentError.new(); end
98
+ if not request.has_key?('gatheringPoolName'); raise ArgumentError.new(); end
99
+ if not request['gatheringPoolName']; raise ArgumentError.new(); end
100
+ query = {}
101
+ return get(
102
+ 'Gs2Realtime',
103
+ 'GetGatheringPool',
104
+ @@ENDPOINT,
105
+ '/gatheringPool/' + request['gatheringPoolName'],
106
+ query);
107
+ end
108
+
109
+ # ギャザリングプールを更新
110
+ #
111
+ # @param request [Array]
112
+ # * gatheringPoolName => ギャザリングプール名
113
+ # * description => 説明文
114
+ # @return [Array]
115
+ # * item
116
+ # * gatheringPoolId => ギャザリングプールID
117
+ # * ownerId => オーナーID
118
+ # * name => ギャザリングプール名
119
+ # * description => 説明文
120
+ # * createAt => 作成日時
121
+ def update_gathering_pool(request)
122
+ if not request; raise ArgumentError.new(); end
123
+ if not request.has_key?('gatheringPoolName'); raise ArgumentError.new(); end
124
+ if not request['gatheringPoolName']; raise ArgumentError.new(); end
125
+ body = {}
126
+ if request.has_key?('description'); body['description'] = request['description']; end
127
+ query = {}
128
+ return put(
129
+ 'Gs2Realtime',
130
+ 'UpdateGatheringPool',
131
+ @@ENDPOINT,
132
+ '/gatheringPool/' + request['gatheringPoolName'],
133
+ body,
134
+ query);
135
+ end
136
+
137
+ # ギャザリングプールを削除
138
+ #
139
+ # @param request [Array]
140
+ # * gatheringPoolName => ギャザリングプール名
141
+ def delete_gathering_pool(request)
142
+ if not request; raise ArgumentError.new(); end
143
+ if not request.has_key?('gatheringPoolName'); raise ArgumentError.new(); end
144
+ if not request['gatheringPoolName']; raise ArgumentError.new(); end
145
+ query = {}
146
+ return delete(
147
+ 'Gs2Realtime',
148
+ 'DeleteGatheringPool',
149
+ @@ENDPOINT,
150
+ '/gatheringPool/' + request['gatheringPoolName'],
151
+ query);
152
+ end
153
+
154
+ # ギャザリングリストを取得
155
+ #
156
+ # @param request [Array]
157
+ # * gatheringPoolName => ギャザリングプール名
158
+ # @param pageToken [String] ページトークン
159
+ # @param limit [Integer] 取得件数
160
+ # @return [Array]
161
+ # * items
162
+ # [Array]
163
+ # * gatheringId => ギャザリングID
164
+ # * ownerId => オーナーID
165
+ # * name => ギャザリング名
166
+ # * hostId => ホストID
167
+ # * ipAddress => IPアドレス
168
+ # * port => 待ち受けポート
169
+ # * secret => 暗号鍵
170
+ # * userIds => 参加ユーザIDリスト
171
+ # * createAt => 作成日時
172
+ # * nextPageToken => 次ページトークン
173
+ def describe_gathering(request, pageToken = nil, limit = nil)
174
+ if not request; raise ArgumentError.new(); end
175
+ if not request.has_key?('gatheringPoolName'); raise ArgumentError.new(); end
176
+ if not request['gatheringPoolName']; raise ArgumentError.new(); end
177
+ query = {}
178
+ if pageToken; query['pageToken'] = pageToken; end
179
+ if limit; query['limit'] = limit; end
180
+ return get(
181
+ 'Gs2Realtime',
182
+ 'DescribeGathering',
183
+ @@ENDPOINT,
184
+ '/gatheringPool/' + request['gatheringPoolName'] + '/gathering',
185
+ query);
186
+ end
187
+
188
+ # ギャザリングを作成<br>
189
+ # <br>
190
+ # ギャザリングを作成すると、ゲームサーバが起動します。<br>
191
+ # ゲームサーバはWebSocketで接続することができ、同じゲームサーバに接続しているユーザ間でメッセージをやり取りすることができます。<br>
192
+ # ゲームサーバとの通信プロトコルの説明については別途ドキュメントを確認してください。<br>
193
+ # <br>
194
+ # userIds にユーザIDを指定することで、ギャザリングに参加できるユーザのIDを制限することができます。<br>
195
+ # ギャザリング作成時に参加するユーザが確定している場合は指定してください。<br>
196
+ # 省略すると、暗号鍵を知っていれば誰でも参加することができます。<br>
197
+ #
198
+ # @param request [Array]
199
+ # * gatheringPoolName => ギャザリングプール名
200
+ # * name => ギャザリング名
201
+ # * userIds => 参加ユーザIDリスト
202
+ # @return [Array]
203
+ # * item
204
+ # * gatheringId => ギャザリングID
205
+ # * ownerId => オーナーID
206
+ # * name => ギャザリング名
207
+ # * hostId => ホストID
208
+ # * ipAddress => IPアドレス
209
+ # * port => 待ち受けポート
210
+ # * secret => 暗号鍵
211
+ # * userIds => 参加ユーザIDリスト
212
+ # * createAt => 作成日時
213
+ def create_gathering(request)
214
+ if not request; raise ArgumentError.new(); end
215
+ if not request.has_key?('gatheringPoolName'); raise ArgumentError.new(); end
216
+ if not request['gatheringPoolName']; raise ArgumentError.new(); end
217
+ body = {}
218
+ if request.has_key?('name'); body['name'] = request['name']; end
219
+ if request.has_key?('userIds')
220
+ body['userIds'] = request['userIds']
221
+ if body['userIds'].is_a?(Array); body['userIds'] = body['userIds'].join(','); end
222
+ end
223
+ query = {}
224
+ return post(
225
+ 'Gs2Realtime',
226
+ 'CreateGathering',
227
+ @@ENDPOINT,
228
+ '/gatheringPool/' + request['gatheringPoolName'] + '/gathering',
229
+ body,
230
+ query);
231
+ end
232
+
233
+ # ギャザリングを取得
234
+ #
235
+ # @param request [Array]
236
+ # * gatheringPoolName => ギャザリングプール名
237
+ # * gatheringName => ギャザリング名
238
+ # @return [Array]
239
+ # * item
240
+ # * gatheringId => ギャザリングID
241
+ # * ownerId => オーナーID
242
+ # * name => ギャザリング名
243
+ # * hostId => ホストID
244
+ # * ipAddress => IPアドレス
245
+ # * port => 待ち受けポート
246
+ # * secret => 暗号鍵
247
+ # * userIds => 参加ユーザIDリスト
248
+ # * createAt => 作成日時
249
+ def get_gathering(request)
250
+ if not request; raise ArgumentError.new(); end
251
+ if not request.has_key?('gatheringPoolName'); raise ArgumentError.new(); end
252
+ if not request['gatheringPoolName']; raise ArgumentError.new(); end
253
+ if not request.has_key?('gatheringName'); raise ArgumentError.new(); end
254
+ if not request['gatheringName']; raise ArgumentError.new(); end
255
+ query = {}
256
+ return get(
257
+ 'Gs2Realtime',
258
+ 'GetGathering',
259
+ @@ENDPOINT,
260
+ '/gatheringPool/' + request['gatheringPoolName'] + '/gathering/' + request['gatheringName'],
261
+ query);
262
+ end
263
+
264
+ # ギャザリングを削除
265
+ #
266
+ # @param request [Array]
267
+ # * gatheringPoolName => ギャザリングプール名
268
+ # * gatheringName => ギャザリング名
269
+ def delete_gathering(request)
270
+ if not request; raise ArgumentError.new(); end
271
+ if not request.has_key?('gatheringPoolName'); raise ArgumentError.new(); end
272
+ if not request['gatheringPoolName']; raise ArgumentError.new(); end
273
+ if not request.has_key?('gatheringName'); raise ArgumentError.new(); end
274
+ if not request['gatheringName']; raise ArgumentError.new(); end
275
+ query = {}
276
+ return delete(
277
+ 'Gs2Realtime',
278
+ 'DeleteGathering',
279
+ @@ENDPOINT,
280
+ '/gatheringPool/' + request['gatheringPoolName'] + '/gathering/' + request['gatheringName'],
281
+ query);
282
+ end
283
+ end
284
+ end end
@@ -0,0 +1,5 @@
1
+ module Gs2
2
+ module Realtime
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require 'gs2/realtime/Client.rb'
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gs2-ruby-sdk-realtime
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Game Server Services, Inc.
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gs2-ruby-sdk-core
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.12'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.12'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - contact@gs2.io
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".buildpath"
63
+ - ".gitignore"
64
+ - ".project"
65
+ - Gemfile
66
+ - README.md
67
+ - Rakefile
68
+ - bin/console
69
+ - bin/setup
70
+ - gs2-ruby-sdk-realtime.gemspec
71
+ - lib/gs2-realtime.rb
72
+ - lib/gs2/realtime/Client.rb
73
+ - lib/gs2/realtime/version.rb
74
+ homepage: https://gs2.io/
75
+ licenses:
76
+ - Apache-2.0
77
+ metadata: {}
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubyforge_project:
94
+ rubygems_version: 2.5.1
95
+ signing_key:
96
+ specification_version: 4
97
+ summary: Game Server Services GS2-Realtime Client Library
98
+ test_files: []