gs2-ruby-sdk-timer 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: be3b68fdf3a5bc13e30ae222bb3d27a391d22ead
4
+ data.tar.gz: 8f7275f88464b1dcc35a4a172729c65b4da13a3b
5
+ SHA512:
6
+ metadata.gz: 74ede709e1bddb074091f3aeeb0946f83a7f69e1a892331868f235a4aa22bb920a0cf77f67f5f0c9c6162bb8991ca7cb6986663244b922d6fe8cb71c0e6d1f5f
7
+ data.tar.gz: 32499ee842a5e0964e6fa55bc964e219b29d574df25a466a65a07b778af1a256d7a6251c8fd9b3bc173e48e1bee041bd69f888b9f30f9bb5e44971f620e69504
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,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.project ADDED
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <projectDescription>
3
+ <name>gs2-sdk-for-ruby-timer</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-timer
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/timer"
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/timer/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gs2-ruby-sdk-timer"
8
+ spec.version = Gs2::Timer::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-Timer 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,274 @@
1
+ require 'gs2/core/AbstractClient.rb'
2
+
3
+ module Gs2 module Timer
4
+
5
+ # GS2-Timer クライアント
6
+ #
7
+ # @author Game Server Services, Inc.
8
+ class Client < Gs2::Core::AbstractClient
9
+
10
+ @@ENDPOINT = 'timer'
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
+ # * timerPoolId => タイマープールID
38
+ # * ownerId => オーナーID
39
+ # * name => タイマープール名
40
+ # * description => 説明文
41
+ # * createAt => 作成日時
42
+ # * nextPageToken => 次ページトークン
43
+ def describe_timer_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
+ 'Gs2Timer',
49
+ 'DescribeTimerPool',
50
+ @@ENDPOINT,
51
+ '/timerPool',
52
+ query)
53
+ end
54
+
55
+ # タイマープールを作成。<br>
56
+ # <br>
57
+ # GS2-Timer を利用するには、まずタイマープールを作成する必要があります。<br>
58
+ # タイマープールには複数のタイマーを格納することができます。<br>
59
+ #
60
+ # @param request [Array]
61
+ # * name => タイマープール名
62
+ # * description => 説明文
63
+ # @return [Array]
64
+ # * item
65
+ # * timerPoolId => タイマープールID
66
+ # * ownerId => オーナーID
67
+ # * name => タイマープール名
68
+ # * description => 説明文
69
+ # * createAt => 作成日時
70
+ def create_timer_pool(request)
71
+ body = {}
72
+ if not request; raise ArgumentError.new() end
73
+ if request.has_key?('name'); body['name'] = request['name'] end
74
+ if request.has_key?('description'); body['description'] = request['description'] end
75
+ return post(
76
+ 'Gs2Timer',
77
+ 'CreateTimerPool',
78
+ @@ENDPOINT,
79
+ '/timerPool',
80
+ body)
81
+ end
82
+
83
+ # タイマープールを更新。<br>
84
+ #
85
+ # @param request [Array]
86
+ # * timerPoolName => タイマープール名
87
+ # * description => 説明文
88
+ # @return [Array]
89
+ # * item
90
+ # * timerPoolId => タイマープールID
91
+ # * ownerId => オーナーID
92
+ # * name => タイマープール名
93
+ # * description => 説明文
94
+ # * createAt => 作成日時
95
+ def update_timer_pool(request)
96
+ body = {}
97
+ if not request; raise ArgumentError.new() end
98
+ if not request.has_key?('timerPoolName'); raise ArgumentError.new() end
99
+ if request.has_key?('description'); body['description'] = request['description'] end
100
+ return put(
101
+ 'Gs2Timer',
102
+ 'UpdateTimerPool',
103
+ @@ENDPOINT,
104
+ '/timerPool/' + request['timerPoolName'],
105
+ body)
106
+ end
107
+
108
+ # タイマープールを取得
109
+ #
110
+ # @param request [Array]
111
+ # * timerPoolName => タイマープール名
112
+ # @return [Array]
113
+ # * item
114
+ # * timerPoolId => タイマープールID
115
+ # * ownerId => オーナーID
116
+ # * name => タイマープール名
117
+ # * description => 説明文
118
+ # * createAt => 作成日時
119
+ def get_timer_pool(request)
120
+ if not request; raise ArgumentError.new() end
121
+ if not request.has_key?('timerPoolName'); raise ArgumentError.new() end
122
+ if request['timerPoolName'] == nil; raise ArgumentError.new() end
123
+ return get(
124
+ 'Gs2Timer',
125
+ 'GetTimerPool',
126
+ @@ENDPOINT,
127
+ '/timerPool/' + request['timerPoolName'])
128
+ end
129
+
130
+ # タイマープールを削除
131
+ #
132
+ # @param request [Array]
133
+ # * timerPoolName => タイマープール名
134
+ def delete_timer_pool(request)
135
+ if not request; raise ArgumentError.new() end
136
+ if not request.has_key?('timerPoolName'); raise ArgumentError.new() end
137
+ if request['timerPoolName'] == nil; raise ArgumentError.new() end
138
+ return delete(
139
+ 'Gs2Timer',
140
+ 'DeleteTimerPool',
141
+ @@ENDPOINT,
142
+ '/timerPool/' + request['timerPoolName'])
143
+ end
144
+
145
+ # タイマーリストを取得
146
+ #
147
+ # @param request [Array]
148
+ # * timerPoolName => タイマープール名
149
+ # @param string $pageToken ページトークン
150
+ # @param integer $limit 取得件数
151
+ # @return [Array]
152
+ # * items
153
+ # [Array]
154
+ # * timerId => タイマーID
155
+ # * timerPoolId => タイマープールID
156
+ # * ownerId => オーナーID
157
+ # * callbackMethod => HTTPメソッド
158
+ # * callbackUrl => コールバックURL
159
+ # * callbackBody => コールバックボディ
160
+ # * executeTime => 実行時間
161
+ # * retryMax => 最大リトライ回数
162
+ # * createAt => 作成日時
163
+ # * nextPageToken => 次ページトークン
164
+ def describe_timer(request, pageToken = nil, limit = nil)
165
+ if not request; raise ArgumentError.new(); end
166
+ if not request.has_key?('timerPoolName'); raise ArgumentError.new(); end
167
+ if request['timerPoolName'] == nil; raise ArgumentError.new(); end
168
+ query = {}
169
+ if pageToken; query['pageToken'] = pageToken; end
170
+ if limit; query['limit'] = limit; end
171
+ return get(
172
+ 'Gs2Timer',
173
+ 'DescribeTimer',
174
+ @@ENDPOINT,
175
+ '/timerPool/' + request['timerPoolName'] + '/timer',
176
+ query)
177
+ end
178
+
179
+ # タイマーを作成<br>
180
+ # <br>
181
+ # タイマーを作成すると、指定した時刻に指定したURLに指定したパラメータを持ったアクセスを発生させます。<br>
182
+ # 基本的には指定した時刻以降に60秒以内に呼び出し処理が開始されます。<br>
183
+ # 混雑時には60秒以上かかることがありますので、タイミングがシビアな処理には向きません。<br>
184
+ # <br>
185
+ # アカウントBANを指定した時刻付近で解除する。など、タイミングがシビアでない処理で利用することをおすすめします。<br>
186
+ #
187
+ # @param request [Array]
188
+ # * callbackMethod => HTTPメソッド
189
+ # * callbackUrl => コールバックURL
190
+ # * callbackBody => コールバックボディ
191
+ # * executeTime => 実行時間
192
+ # * retryMax => 最大リトライ回数(OPTIONAL)
193
+ # @return [Array]
194
+ # * item
195
+ # * timerId => タイマーID
196
+ # * timerPoolId => タイマープールID
197
+ # * ownerId => オーナーID
198
+ # * callbackMethod => HTTPメソッド
199
+ # * callbackUrl => コールバックURL
200
+ # * callbackBody => コールバックボディ
201
+ # * executeTime => 実行時間
202
+ # * retryMax => 最大リトライ回数
203
+ # * createAt => 作成日時
204
+ def create_timer(request)
205
+ if not request; raise ArgumentError.new(); end
206
+ if not request.has_key?('timerPoolName'); raise ArgumentError.new(); end
207
+ if request['timerPoolName'] == nil; raise ArgumentError.new(); end
208
+ body = {};
209
+ if request.has_key?('callbackMethod'); body['callbackMethod'] = request['callbackMethod']; end
210
+ if request.has_key?('callbackUrl'); body['callbackUrl'] = request['callbackUrl']; end
211
+ if request.has_key?('executeTime'); body['executeTime'] = request['executeTime']; end
212
+ if request.has_key?('retryMax'); body['retryMax'] = request['retryMax']; end
213
+ query = {}
214
+ return post(
215
+ 'Gs2Timer',
216
+ 'CreateTimer',
217
+ @@ENDPOINT,
218
+ '/timerPool/' + request['timerPoolName'] + '/timer',
219
+ body,
220
+ query)
221
+ end
222
+
223
+ # タイマーを取得
224
+ #
225
+ # @param request [Array]
226
+ # * timerPoolName => タイマープール名
227
+ # * timerId => タイマーID
228
+ # @return [Array]
229
+ # * item
230
+ # * timerId => タイマーID
231
+ # * timerPoolId => タイマープールID
232
+ # * ownerId => オーナーID
233
+ # * callbackMethod => HTTPメソッド
234
+ # * callbackUrl => コールバックURL
235
+ # * callbackBody => コールバックボディ
236
+ # * executeTime => 実行時間
237
+ # * retryMax => 最大リトライ回数
238
+ # * createAt => 作成日時
239
+ def get_timer(request)
240
+ if not request; raise ArgumentError.new(); end
241
+ if not request.has_key?('timerPoolName'); raise ArgumentError.new(); end
242
+ if request['timerPoolName'] == nil; raise ArgumentError.new(); end
243
+ if not request.has_key?('timerId'); raise ArgumentError.new(); end
244
+ if request['timerId'] == nil; raise ArgumentError.new(); end
245
+ query = {}
246
+ return get(
247
+ 'Gs2Timer',
248
+ 'GetTimer',
249
+ @@ENDPOINT,
250
+ '/timerPool/' + request['timerPoolName'] + '/timer/' + request['timerId'],
251
+ query)
252
+ end
253
+
254
+ # タイマーを削除
255
+ #
256
+ # @param request [Array]
257
+ # * timerPoolName => タイマープール名
258
+ # * timerId => タイマーID
259
+ def delete_timer(request)
260
+ if not request; raise ArgumentError.new(); end
261
+ if not request.has_key?('timerPoolName'); raise ArgumentError.new(); end
262
+ if request['timerPoolName'] == nil; raise ArgumentError.new(); end
263
+ if not request.has_key?('timerId'); raise ArgumentError.new(); end
264
+ if request['timerId'] == nil; raise ArgumentError.new(); end
265
+ query = {}
266
+ return delete(
267
+ 'Gs2Timer',
268
+ 'DeleteTimer',
269
+ @@ENDPOINT,
270
+ '/timerPool/' + request['timerPoolName'] + '/timer/' + request['timerId'],
271
+ query)
272
+ end
273
+ end
274
+ end end
@@ -0,0 +1,5 @@
1
+ module Gs2
2
+ module Timer
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
data/lib/gs2-timer.rb ADDED
@@ -0,0 +1 @@
1
+ require 'gs2/timer/Client.rb'
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gs2-ruby-sdk-timer
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-timer.gemspec
71
+ - lib/gs2-timer.rb
72
+ - lib/gs2/timer/Client.rb
73
+ - lib/gs2/timer/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-Timer Client Library
98
+ test_files: []