gs2-ruby-sdk-notification 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: 2f0f39fc7c3e46e816f3c47856a68b9a830c62fa
4
+ data.tar.gz: 3d6618c99625b92ee4fccdeebce661363c2fbe0a
5
+ SHA512:
6
+ metadata.gz: 4e4a131fdfe5a677146b9ee1c3d869b51b593e223dbce0e74774f3b5d83fd329e53387a699fa6e7e6e511c59c39e7ddcb132c1ed896bac4f0b22f04869344db6
7
+ data.tar.gz: 12b4dc496957655e35fb291326950579661157272379d5eceaa040539d629d6a2c731ab26e1d052ecf9a1adf03fffdaccaf91ac81013976a1e34cba338bc23b6
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-notification</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-notification
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/notification"
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/notification/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gs2-ruby-sdk-notification"
8
+ spec.version = Gs2::Notification::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-Notification 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 @@
1
+ require 'gs2/notification/Client.rb'
@@ -0,0 +1,289 @@
1
+ require 'gs2/core/AbstractClient.rb'
2
+
3
+ module Gs2 module Notification
4
+
5
+ # GS2-Notification クライアント
6
+ #
7
+ # @author Game Server Services, Inc.
8
+ class Client < Gs2::Core::AbstractClient
9
+
10
+ @@ENDPOINT = 'notification'
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
+ # * notificationId => 通知ID
38
+ # * ownerId => オーナーID
39
+ # * name => 通知名
40
+ # * description => 説明文
41
+ # * createAt => 作成日時
42
+ # * updateAt => 更新日時
43
+ # * nextPageToken => 次ページトークン
44
+ def describe_notification(pageToken = nil, limit = nil)
45
+ query = {}
46
+ if pageToken; query['pageToken'] = pageToken; end
47
+ if limit; query['limit'] = limit; end
48
+ return get(
49
+ 'Gs2Notification',
50
+ 'DescribeNotification',
51
+ @@ENDPOINT,
52
+ '/notification',
53
+ query);
54
+ end
55
+
56
+ # 通知を作成<br>
57
+ # <br>
58
+ # 通知はGS2内で発生したイベントを受け取る手段を提供します。<br>
59
+ # 例えば、GS2-Watch の監視データが一定の閾値を超えた時に通知する。といった用途に利用できます。<br>
60
+ # <br>
61
+ # GS2 のサービスの多くはクオータを買い、その範囲内でサービスを利用する形式が多く取られていますが、<br>
62
+ # 現在の消費クオータが GS2-Watch で取れますので、クオータの消費量が予約量の80%を超えたら通知をだす。というような使い方ができます。<br>
63
+ #
64
+ # @param request [Array]
65
+ # * name => 通知名
66
+ # * description => 説明文
67
+ # @return [Array]
68
+ # * item
69
+ # * notificationId => 通知ID
70
+ # * ownerId => オーナーID
71
+ # * name => 通知名
72
+ # * description => 説明文
73
+ # * createAt => 作成日時
74
+ # * updateAt => 更新日時
75
+ def create_notification(request)
76
+ if not request; raise ArgumentError.new(); end
77
+ body = {}
78
+ if request.has_key?('name'); body['name'] = request['name']; end
79
+ if request.has_key?('description'); body['description'] = request['description']; end
80
+ query = {}
81
+ return post(
82
+ 'Gs2Notification',
83
+ 'CreateNotification',
84
+ @@ENDPOINT,
85
+ '/notification',
86
+ body,
87
+ query);
88
+ end
89
+
90
+ # 通知を取得
91
+ #
92
+ # @param request [Array]
93
+ # * notificationName => 通知名
94
+ # @return [Array]
95
+ # * item
96
+ # * notificationId => 通知ID
97
+ # * ownerId => オーナーID
98
+ # * name => 通知名
99
+ # * description => 説明文
100
+ # * createAt => 作成日時
101
+ # * updateAt => 更新日時
102
+ def get_notification(request)
103
+ if not request; raise ArgumentError.new(); end
104
+ if not request.has_key?('notificationName'); raise ArgumentError.new(); end
105
+ if not request['notificationName']; raise ArgumentError.new(); end
106
+ query = {}
107
+ return get(
108
+ 'Gs2Notification',
109
+ 'GetNotification',
110
+ @@ENDPOINT,
111
+ '/notification/' + request['notificationName'],
112
+ query);
113
+ end
114
+
115
+ # 通知を更新
116
+ #
117
+ # @param request [Array]
118
+ # * notificationName => 通知名
119
+ # * description => 説明文
120
+ # @return [Array]
121
+ # * item
122
+ # * notificationId => 通知ID
123
+ # * ownerId => オーナーID
124
+ # * name => 通知名
125
+ # * description => 説明文
126
+ # * createAt => 作成日時
127
+ # * updateAt => 更新日時
128
+ def update_notification(request)
129
+ if not request; raise ArgumentError.new(); end
130
+ if not request.has_key?('notificationName'); raise ArgumentError.new(); end
131
+ if not request['notificationName']; raise ArgumentError.new(); end
132
+ body = {}
133
+ if request.has_key?('description'); body['description'] = request['description']; end
134
+ query = {}
135
+ return put(
136
+ 'Gs2Notification',
137
+ 'UpdateNotification',
138
+ @@ENDPOINT,
139
+ '/notification/' + request['notificationName'],
140
+ body,
141
+ query);
142
+ end
143
+
144
+ # 通知を削除
145
+ #
146
+ # @param request [Array]
147
+ # * notificationName => 通知名
148
+ def delete_notification(request)
149
+ if not request; raise ArgumentError.new(); end
150
+ if not request.has_key?('notificationName'); raise ArgumentError.new(); end
151
+ if not request['notificationName']; raise ArgumentError.new(); end
152
+ query = {}
153
+ return delete(
154
+ 'Gs2Notification',
155
+ 'DeleteNotification',
156
+ @@ENDPOINT,
157
+ '/notification/' + request['notificationName'],
158
+ query);
159
+ end
160
+
161
+ # 通知先リストを取得
162
+ #
163
+ # @param request [Array]
164
+ # * notificationName => 通知名
165
+ # @param pageToken [String] ページトークン
166
+ # @param limit [Integer] 取得件数
167
+ # @return [Array]
168
+ # * items
169
+ # [Array]
170
+ # * subscribeId => 通知先ID
171
+ # * notificationId => 通知ID
172
+ # * type => 通知プロトコル
173
+ # * endpoint => 通知先
174
+ # * createAt => 作成日時
175
+ # * nextPageToken => 次ページトークン
176
+ def describe_subscribe(request, pageToken = nil, limit = nil)
177
+ if not request; raise ArgumentError.new(); end
178
+ if not request.has_key?('notificationName'); raise ArgumentError.new(); end
179
+ if not request['notificationName']; raise ArgumentError.new(); end
180
+ query = {}
181
+ if pageToken; query['pageToken'] = pageToken; end
182
+ if limit; query['limit'] = limit; end
183
+ return get(
184
+ 'Gs2Notification',
185
+ 'DescribeSubscribe',
186
+ @@ENDPOINT,
187
+ '/notification/' + request['notificationName'] + '/subscribe',
188
+ query);
189
+ end
190
+
191
+ # 通知先を作成<br>
192
+ # <br>
193
+ # E-Mail, HTTP/HTTPS 通信を指定して通知先を登録できます。<br>
194
+ # 通知先は1つの通知に対して複数登録することもできます。<br>
195
+ # <br>
196
+ # そのため、メールとSlackに通知する。といった利用ができます。<br>
197
+ # <br>
198
+ # type に指定できるパラメータ<br>
199
+ #
200
+ # * email
201
+ # * http/https
202
+ #
203
+ # <br>
204
+ # endpoint には type に指定したプロトコルによって指定する内容が変わります。<br>
205
+ # email を選択した場合には メールアドレスを、<br>
206
+ # http/https を選択した場合には URL を指定してください。<br>
207
+ # <br>
208
+ # http/https を選択した場合には登録時に疎通確認を行います。<br>
209
+ # 指定したURLでPOSTリクエストを受け付けられる状態で登録してください。<br>
210
+ # 疎通確認の通信は通常の通知とは異なり、body パラメータがからの通信が発生します。ご注意ください。<br>
211
+ #
212
+ # @param request [Array]
213
+ # * notificationName => 通知名
214
+ # * name => 通知先名
215
+ # * type => 通知プロトコル
216
+ # * endpoint => 通知先
217
+ # @return [Array]
218
+ # * item
219
+ # * subscribeId => 通知先ID
220
+ # * notificationId => 通知ID
221
+ # * type => 通知プロトコル
222
+ # * endpoint => 通知先
223
+ # * createAt => 作成日時
224
+ def create_subscribe(request)
225
+ if not request; raise ArgumentError.new(); end
226
+ if not request.has_key?('notificationName'); raise ArgumentError.new(); end
227
+ if not request['notificationName']; raise ArgumentError.new(); end
228
+ body = {}
229
+ if request.has_key?('name'); body['name'] = request['name']; end
230
+ if request.has_key?('type'); body['type'] = request['type']; end
231
+ if request.has_key?('endpoint'); body['endpoint'] = request['endpoint']; end
232
+ query = {}
233
+ return post(
234
+ 'Gs2Notification',
235
+ 'CreateSubscribe',
236
+ @@ENDPOINT,
237
+ '/notification/' + request['notificationName'] + '/subscribe',
238
+ body,
239
+ query);
240
+ end
241
+
242
+ # 通知先を取得
243
+ #
244
+ # @param request [Array]
245
+ # * notificationName => 通知名
246
+ # * subscribeId => 通知先ID
247
+ # @return [Array]
248
+ # * item
249
+ # * subscribeId => 通知先ID
250
+ # * notificationId => 通知ID
251
+ # * type => 通知プロトコル
252
+ # * endpoint => 通知先
253
+ # * createAt => 作成日時
254
+ def get_subscribe(request)
255
+ if not request; raise ArgumentError.new(); end
256
+ if not request.has_key?('notificationName'); raise ArgumentError.new(); end
257
+ if not request['notificationName']; raise ArgumentError.new(); end
258
+ if not request.has_key?('subscribeId'); raise ArgumentError.new(); end
259
+ if not request['subscribeId']; raise ArgumentError.new(); end
260
+ query = {}
261
+ return get(
262
+ 'Gs2Notification',
263
+ 'GetSubscribe',
264
+ @@ENDPOINT,
265
+ '/notification/' + request['notificationName'] + '/subscribe/' + request['subscribeId'],
266
+ query);
267
+ end
268
+
269
+ # 通知先を削除
270
+ #
271
+ # @param request [Array]
272
+ # * notificationName => 通知名
273
+ # * subscribeId => 通知先ID
274
+ def delete_subscribe(request)
275
+ if not request; raise ArgumentError.new(); end
276
+ if not request.has_key?('notificationName'); raise ArgumentError.new(); end
277
+ if not request['notificationName']; raise ArgumentError.new(); end
278
+ if not request.has_key?('subscribeId'); raise ArgumentError.new(); end
279
+ if not request['subscribeId']; raise ArgumentError.new(); end
280
+ query = {}
281
+ return delete(
282
+ 'Gs2Notification',
283
+ 'DeleteSubscribe',
284
+ @@ENDPOINT,
285
+ '/notification/' + request['notificationName'] + '/subscribe/' + request['subscribeId'],
286
+ query);
287
+ end
288
+ end
289
+ end end
@@ -0,0 +1,5 @@
1
+ module Gs2
2
+ module Notification
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gs2-ruby-sdk-notification
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-notification.gemspec
71
+ - lib/gs2-notification.rb
72
+ - lib/gs2/notification/Client.rb
73
+ - lib/gs2/notification/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-Notification Client Library
98
+ test_files: []