gt_req 0.1.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: f87259137c52c597338b0f0bf1fe08c758d3b83f
4
+ data.tar.gz: 502ddcdcb41a28fca107692f9b581851c34bf8e1
5
+ SHA512:
6
+ metadata.gz: d560fd8f254a56b95288f8531640c157eb6c187bca3ace1214f04f178e014d743e53c5e40cdd769161fd54b56452c96f33ce236f1a834fc7c31ab339fc356c3f
7
+ data.tar.gz: 3f623ff504ae2d9d5d57bb42a7ea6d9723ef3493ce330ae5e26687e027b05a90e076375d0716a1ef969c5cc06fb60af939d60f56846e7bda0a041b2a16a68815
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
+ *.gem
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.0
4
+ before_install: gem install bundler -v 1.11.2
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in gt_req.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 dfp
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # GtReq
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gt_req`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'gt_req'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gt_req
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gt_req.
36
+
37
+
38
+ ## License
39
+
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/**/*_test.rb']
8
+ end
9
+
10
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gt_req"
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
data/gt_req.gemspec ADDED
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'gt_req/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gt_req"
8
+ spec.version = GtReq::VERSION
9
+ spec.authors = ["dfp"]
10
+ spec.email = ["dangfeipeng@gmail.com"]
11
+
12
+ spec.summary = "igetui ruby sdk."
13
+ spec.description = "ruby-sdk of igetui.com push notification service"
14
+ spec.homepage = ""
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "ruby-protocol-buffers", '~> 1.6'
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.11"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "minitest", "~> 5.0"
27
+ end
@@ -0,0 +1,42 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require_relative '../gt_req/template/abstract_template'
3
+ module GtReq
4
+ class IGtMessage
5
+ def initialize()
6
+ @isOffline = false
7
+ @offlineExpireTime = 0
8
+ @data = AbstractTemplate.new
9
+ end
10
+
11
+ attr_accessor :isOffline
12
+ attr_accessor :offlineExpireTime
13
+ attr_accessor :data
14
+
15
+ end
16
+
17
+ class SingleMessage < IGtMessage
18
+ def initialize()
19
+ super
20
+ end
21
+ end
22
+
23
+ class ListMessage < IGtMessage
24
+ def initialize()
25
+ super
26
+ end
27
+ end
28
+
29
+ class AppMessage < IGtMessage
30
+ def initialize()
31
+ @appIdList = []
32
+ @phoneTypeList = []
33
+ @provinceList = []
34
+ @tagList = []
35
+ end
36
+
37
+ attr_accessor :appIdList
38
+ attr_accessor :phoneTypeList
39
+ attr_accessor :provinceList
40
+ attr_accessor :tagList
41
+ end
42
+ end
@@ -0,0 +1,193 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'net/http'
4
+ require 'uri'
5
+ require 'json'
6
+ require 'digest/md5'
7
+ require 'base64'
8
+
9
+ module GtReq
10
+ class IGtPush
11
+ def initialize(host, appKey, masterSecret)
12
+ @host = host
13
+ @appKey = appKey
14
+ @masterSecret = masterSecret
15
+ end
16
+
17
+ def connect()
18
+ timeStamp = Time.now.to_i
19
+ sign = md5(@appKey + timeStamp.to_s + @masterSecret)
20
+
21
+ data = {
22
+ 'action' => 'connect',
23
+ 'appkey' => @appKey,
24
+ 'timeStamp' => timeStamp,
25
+ 'sign' => sign,
26
+ }
27
+
28
+ ret = httpPost(data)
29
+
30
+ if 'success'==(ret['result'])
31
+ true
32
+ end
33
+ puts ret
34
+
35
+ false
36
+ end
37
+
38
+ def pushMessageToSingle(message, target)
39
+ template = message.data
40
+ base64Str = Base64.strict_encode64(template.getTransparent().serialize_to_string)
41
+ data = {
42
+ 'action' => 'pushMessageToSingleAction',
43
+ 'appkey' => @appKey,
44
+ 'clientData' => base64Str,
45
+ 'transmissionContent' => template.transmissionContent,
46
+ 'isOffline' => message.isOffline,
47
+ 'offlineExpireTime' => message.offlineExpireTime,
48
+ 'appId' => target.appId,
49
+ 'clientId' => target.clientId,
50
+ 'type' => 2, #default is message
51
+ 'pushType' => template.getPushType()
52
+ }
53
+
54
+ httpPostJson(data)
55
+ end
56
+
57
+ def pushMessageToList(contentId, targets)
58
+
59
+ targetList = []
60
+ targets.each{
61
+ |target| targetList.push({'appId' => target.appId, 'clientId' => target.clientId})
62
+ }
63
+
64
+ data = {
65
+ 'action' => 'pushMessageToListAction',
66
+ 'appkey' => @appKey,
67
+ 'contentId' => contentId,
68
+ 'needDetails' => true,
69
+ 'targetList' => targetList,
70
+ 'type' => 2
71
+ }
72
+
73
+ httpPostJson(data)
74
+ end
75
+
76
+ def pushMessageToApp(message)
77
+ template = message.data
78
+ base64Str = Base64.strict_encode64(template.getTransparent().serialize_to_string)
79
+ data = {
80
+ 'action' => 'pushMessageToAppAction',
81
+ 'appkey' => @appKey,
82
+ 'clientData' => base64Str,
83
+ 'transmissionContent' => template.transmissionContent,
84
+ 'isOffline' => message.isOffline,
85
+ 'offlineExpireTime' => message.offlineExpireTime,
86
+ 'appIdList' => message.appIdList,
87
+ 'phoneTypeList' => message.phoneTypeList,
88
+ 'provinceList' => message.provinceList,
89
+ 'tagList' => message.tagList,
90
+ 'type' => 2,
91
+ 'pushType' => template.getPushType()
92
+ }
93
+ httpPostJson(data)
94
+
95
+ end
96
+
97
+ def stop(contentId)
98
+ data = {
99
+ 'action' => 'stopTaskAction',
100
+ 'appkey' => @appKey,
101
+ 'contentId' => contentId
102
+ }
103
+
104
+ ret = httpPostJson(data)
105
+ if ret['result']=='ok'
106
+ true
107
+ end
108
+ false
109
+ end
110
+
111
+ def getClientIdStatus(appId, clientId)
112
+ data = {
113
+ 'action' => 'getClientIdStatusAction',
114
+ 'appkey' => @appKey,
115
+ 'appId' => appId,
116
+ 'clientId' => clientId
117
+ }
118
+ httpPostJson(data)
119
+ end
120
+
121
+
122
+ def getContentId(message)
123
+ template = message.data
124
+ base64Str = Base64.strict_encode64(template.getTransparent().serialize_to_string)
125
+ data = {
126
+ 'action' => 'getContentIdAction',
127
+ 'appkey' => @appKey,
128
+ 'clientData' => base64Str,
129
+ 'transmissionContent' => template.transmissionContent,
130
+ 'isOffline' => message.isOffline,
131
+ 'offlineExpireTime' => message.offlineExpireTime,
132
+ 'pushType' => template.getPushType()
133
+ }
134
+ ret = httpPostJson(data)
135
+
136
+ if 'ok'==(ret['result'])
137
+ ret['contentId']
138
+ else
139
+ ''
140
+ end
141
+ end
142
+
143
+ def cancelContentId(contentId)
144
+ data = {
145
+ 'action' => 'cancleContentIdAction',
146
+ 'contentId' => contentId,
147
+ }
148
+ ret = httpPostJson(data)
149
+ if 'ok'==ret['result']
150
+ true
151
+ end
152
+ false
153
+ end
154
+
155
+ def md5(text)
156
+ Digest::MD5.hexdigest(text)
157
+ end
158
+
159
+ def httpPost(params)
160
+ params['version'] = '3.0.0.0'
161
+ data = params.to_json
162
+
163
+ url = URI.parse(@host)
164
+ req = Net::HTTP::Post.new(url.path, initheader = {'Content-Type' => 'application/json'})
165
+ req.body = data
166
+
167
+ is_fail = true
168
+ retry_time_limit = 3
169
+ try_time = 0
170
+ while is_fail and try_time < retry_time_limit
171
+ begin
172
+ res = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
173
+ is_fail = false
174
+ rescue
175
+ is_fail = true
176
+ try_time += 1
177
+ puts ('try ' + try_time.to_s + ' time failed, time out.')
178
+ end
179
+ end
180
+ JSON.parse res.body
181
+ end
182
+
183
+ def httpPostJson(params)
184
+ params['version'] = '3.0.0.0'
185
+ ret = httpPost(params)
186
+ if ret!=nil and 'sign_error'==(ret['result'])
187
+ connect()
188
+ ret = httpPost(params)
189
+ end
190
+ ret
191
+ end
192
+ end
193
+ end
@@ -0,0 +1,10 @@
1
+ module GtReq
2
+ class Target
3
+ def initialize()
4
+ @appId = ""
5
+ @clientId = ""
6
+ end
7
+ attr_accessor :appId
8
+ attr_accessor :clientId
9
+ end
10
+ end
@@ -0,0 +1,75 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require_relative '../../protobuf/GtReq.pb'
3
+ require_relative '../../gt_req/template/validate'
4
+
5
+ module GtReq
6
+ class AbstractTemplate
7
+ # 个推appId
8
+ attr_writer :appId
9
+ # 个推appKey
10
+ attr_writer :appKey
11
+ # 设置透传内容
12
+ attr_accessor :transmissionContent
13
+
14
+ def getTransparent()
15
+ transparent = GtReq::Transparent.new
16
+ transparent.id = ''
17
+ transparent.messageId = ''
18
+ transparent.taskId = ''
19
+ transparent.action = 'pushmessage'
20
+ transparent.actionChain = getActionChain
21
+ transparent.pushInfo = getPushInfo
22
+ transparent.appId = @appId
23
+ transparent.appKey = @appKey
24
+
25
+ return transparent
26
+ end
27
+
28
+ def getActionChain()
29
+ return nil
30
+ end
31
+
32
+ def getPushType()
33
+ return ""
34
+ end
35
+
36
+ def getPushInfo()
37
+ if (@pushInfo==nil)
38
+ @pushInfo = GtReq::PushInfo.new
39
+ @pushInfo.actionKey = ''
40
+ @pushInfo.badge = ''
41
+ @pushInfo.message = ''
42
+ @pushInfo.sound = ''
43
+ end
44
+
45
+ return @pushInfo
46
+ end
47
+
48
+ def setPushInfo(actionLocKey, badge, message, sound, payload, locKey, locArgs, launchImage)
49
+ @pushInfo = GtReq::PushInfo.new
50
+ @pushInfo.actionLocKey = actionLocKey
51
+ @pushInfo.badge = badge
52
+ @pushInfo.message = message
53
+ if (sound!=nil)
54
+ @pushInfo.sound = sound
55
+ end
56
+ if (payload!=nil)
57
+ @pushInfo.payload = payload
58
+ end
59
+ if (locKey!=nil)
60
+ @pushInfo.locKey = locKey
61
+ end
62
+ if (locArgs!=nil)
63
+ @pushInfo.locArgs = locArgs
64
+ end
65
+ if (launchImage!=nil)
66
+ @pushInfo.launchImage = launchImage
67
+ end
68
+
69
+ Validate.new.validate(locKey, locArgs, message, actionLocKey, launchImage, badge, sound, payload)
70
+
71
+ return @pushInfo
72
+ end
73
+
74
+ end
75
+ end
@@ -0,0 +1,69 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require_relative 'abstract_template.rb'
3
+
4
+ module GtReq
5
+ class NotificationTemplate < AbstractTemplate
6
+ # 设置透传消息类型:1-收到通知立即启动应用, 2-收到通知不启动应用
7
+ attr_writer :transmissionType
8
+ attr_accessor :text
9
+ attr_accessor :title
10
+ attr_accessor :logo
11
+ attr_accessor :logoURL
12
+ attr_accessor :transmissionType
13
+ attr_accessor :transmissionContent
14
+ attr_accessor :isRing
15
+ attr_accessor :isVibrate
16
+ attr_accessor :isClearable
17
+
18
+ def getActionChain()
19
+ # set actionchain
20
+ actionChain1 = GtReq::ActionChain.new
21
+ actionChain1.actionId = 1
22
+ actionChain1.type = GtReq::ActionChain::Type::Goto
23
+ actionChain1.next = 10000
24
+
25
+ # notification
26
+ actionChain2 = GtReq::ActionChain.new
27
+ actionChain2.actionId = 10000
28
+ actionChain2.type = GtReq::ActionChain::Type::Notification
29
+ actionChain2.title = @title
30
+ actionChain2.text = @text
31
+ actionChain2.logo = @logo
32
+ actionChain2.logoURL = @logoURL
33
+ actionChain2.ring = @ring
34
+ actionChain2.clearable = @isClearable
35
+ actionChain2.buzz = @buzz
36
+ actionChain2.next = 10010
37
+
38
+ # goto
39
+ actionChain3 = GtReq::ActionChain.new
40
+ actionChain3.actionId = 10010
41
+ actionChain3.type = GtReq::ActionChain::Type::Goto
42
+ actionChain3.next = 10030
43
+
44
+ # appStartUp
45
+ appStartUp = GtReq::AppStartUp.new(:android => '', :symbia => '', :ios => '')
46
+
47
+ actionChain4 = GtReq::ActionChain.new
48
+ actionChain4.actionId = 10030
49
+ actionChain4.type = GtReq::ActionChain::Type::Startapp
50
+ actionChain4.appid = ''
51
+ actionChain4.autostart = (1==@transmissionType ? true : false)
52
+ actionChain4.appstartupid = appStartUp
53
+ actionChain4.failedAction = 100
54
+ actionChain4.next = 100
55
+
56
+ # end
57
+
58
+ actionChain5 = GtReq::ActionChain.new
59
+ actionChain5.actionId = 100
60
+ actionChain5.type = GtReq::ActionChain::Type::Eoa
61
+
62
+ return [actionChain1, actionChain2, actionChain3, actionChain4, actionChain5]
63
+ end
64
+
65
+ def getPushType()
66
+ return "NotifyMsg"
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require_relative 'abstract_template.rb'
3
+
4
+ module GtReq
5
+ class TransmissionTemplate < AbstractTemplate
6
+ # 设置透传消息类型:1-收到通知立即启动应用, 2-收到通知不启动应用
7
+ attr_writer :transmissionType
8
+
9
+ def getActionChain()
10
+ actionChain1 = GtReq::ActionChain.new
11
+ actionChain1.actionId = 1
12
+ actionChain1.type = GtReq::ActionChain::Type::Goto
13
+ actionChain1.next = 10030
14
+
15
+ appStartUp = GtReq::AppStartUp.new(:android => '', :symbia => '', :ios => '')
16
+ actionChain2 = GtReq::ActionChain.new
17
+ actionChain2.actionId = 10030
18
+ actionChain2.type = GtReq::ActionChain::Type::Startapp
19
+ actionChain2.appid = ''
20
+ actionChain2.autostart = (1==@transmissionType ? true : false)
21
+ actionChain2.appstartupid = appStartUp
22
+ actionChain2.failedAction = 100
23
+ actionChain2.next = 100
24
+
25
+ actionChain3 = GtReq::ActionChain.new
26
+ actionChain3.actionId = 100
27
+ actionChain3.type = GtReq::ActionChain::Type::Eoa
28
+
29
+ return [actionChain1, actionChain2, actionChain3]
30
+ end
31
+
32
+ def getPushType()
33
+ return "TransmissionMsg"
34
+ end
35
+
36
+ end
37
+ end
@@ -0,0 +1,50 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require 'json'
3
+
4
+ module GtReq
5
+ class Validate
6
+ def validate(locKey, locArgs, message, actionLocKey, launchImage, badge, sound, payload)
7
+ payloadMap = getPayload(locKey, locArgs, message, actionLocKey, launchImage, badge, sound, payload)
8
+ json = JSON.generate payloadMap
9
+ if (json.length>256)
10
+ raise ArgumentError.new("PushInfo length over limit: #{json.length}. Allowed: 256.")
11
+ end
12
+ end
13
+
14
+ def getPayload(locKey, locArgs, message, actionLocKey, launchImage, badge, sound, payload)
15
+ apnsMap = Hash.new
16
+ if (sound!=nil && sound.length>0)
17
+ apnsMap["sound"] = sound
18
+ else
19
+ apnsMap["sound"] = "default"
20
+ end
21
+
22
+ alertMap = Hash.new
23
+ if (launchImage!=nil && launchImage.length>0)
24
+ alertMap["launch-image"] = launchImage
25
+ end
26
+ if (locKey!=nil && locKey.length>0)
27
+ alertMap["loc-key"] = locKey
28
+ if (locArgs!=nil && locArgs.length>0)
29
+ alertMap["loc-args"] = locArgs.split(", ")
30
+ end
31
+ elsif (message!=nil && message.length>0)
32
+ alertMap["body"] = message
33
+ end
34
+ apnsMap["alert"] = alertMap
35
+
36
+ if (actionLocKey!=nil && actionLocKey.length>0)
37
+ apnsMap["action-loc-key"] = actionLocKey
38
+ end
39
+ apnsMap["badge"] = badge
40
+
41
+ h = Hash.new
42
+ h["aps"] = apnsMap
43
+ if (payload!=nil && payload.length>0)
44
+ h["payload"] = payload
45
+ end
46
+
47
+ return h
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,3 @@
1
+ module GtReq
2
+ VERSION = "0.1.1"
3
+ end
data/lib/gt_req.rb ADDED
@@ -0,0 +1,19 @@
1
+ require 'net/http'
2
+ require 'uri'
3
+ require 'json'
4
+ require 'digest/md5'
5
+ require 'base64'
6
+
7
+ module GtReq
8
+
9
+ end
10
+
11
+ require 'gt_req/version'
12
+ require 'protobuf/GtReq.pb'
13
+ require 'gt_req/template/abstract_template'
14
+ require 'gt_req/template/notification_template'
15
+ require 'gt_req/template/transmission_template'
16
+ require 'gt_req/template/validate'
17
+ require 'gt_req/igt_push'
18
+ require 'gt_req/igt_message'
19
+ require 'gt_req/igt_target'
@@ -0,0 +1,398 @@
1
+ #!/usr/bin/env ruby
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+
4
+ require 'protocol_buffers'
5
+
6
+ module GtReq
7
+ # forward declarations
8
+ class GtAuth < ::ProtocolBuffers::Message; end
9
+ class GtAuthResult < ::ProtocolBuffers::Message; end
10
+ class ReqServList < ::ProtocolBuffers::Message; end
11
+ class ReqServListResult < ::ProtocolBuffers::Message; end
12
+ class PushListResult < ::ProtocolBuffers::Message; end
13
+ class PushResult < ::ProtocolBuffers::Message; end
14
+ class PushOSSingleMessage < ::ProtocolBuffers::Message; end
15
+ class PushMMPSingleMessage < ::ProtocolBuffers::Message; end
16
+ class StartMMPBatchTask < ::ProtocolBuffers::Message; end
17
+ class StartOSBatchTask < ::ProtocolBuffers::Message; end
18
+ class PushListMessage < ::ProtocolBuffers::Message; end
19
+ class EndBatchTask < ::ProtocolBuffers::Message; end
20
+ class PushMMPAppMessage < ::ProtocolBuffers::Message; end
21
+ class ServerNotify < ::ProtocolBuffers::Message; end
22
+ class ServerNotifyResult < ::ProtocolBuffers::Message; end
23
+ class OSMessage < ::ProtocolBuffers::Message; end
24
+ class MMPMessage < ::ProtocolBuffers::Message; end
25
+ class Transparent < ::ProtocolBuffers::Message; end
26
+ class PushInfo < ::ProtocolBuffers::Message; end
27
+ class ActionChain < ::ProtocolBuffers::Message; end
28
+ class AppStartUp < ::ProtocolBuffers::Message; end
29
+ class Button < ::ProtocolBuffers::Message; end
30
+ class Target < ::ProtocolBuffers::Message; end
31
+
32
+ # enums
33
+ module CmdID
34
+ include ::ProtocolBuffers::Enum
35
+
36
+ set_fully_qualified_name "GtReq.CmdID"
37
+
38
+ GTHEARDBT = 0
39
+ GTAUTH = 1
40
+ GTAUTH_RESULT = 2
41
+ REQSERVHOST = 3
42
+ REQSERVHOSTRESULT = 4
43
+ PUSHRESULT = 5
44
+ PUSHOSSINGLEMESSAGE = 6
45
+ PUSHMMPSINGLEMESSAGE = 7
46
+ STARTMMPBATCHTASK = 8
47
+ STARTOSBATCHTASK = 9
48
+ PUSHLISTMESSAGE = 10
49
+ ENDBATCHTASK = 11
50
+ PUSHMMPAPPMESSAGE = 12
51
+ SERVERNOTIFY = 13
52
+ PUSHLISTRESULT = 14
53
+ SERVERNOTIFYRESULT = 15
54
+ end
55
+
56
+ module SMSStatus
57
+ include ::ProtocolBuffers::Enum
58
+
59
+ set_fully_qualified_name "GtReq.SMSStatus"
60
+
61
+ Unread = 0
62
+ Read = 1
63
+ end
64
+
65
+ class GtAuth < ::ProtocolBuffers::Message
66
+ set_fully_qualified_name "GtReq.GtAuth"
67
+
68
+ required :string, :sign, 1
69
+ required :string, :appkey, 2
70
+ required :int64, :timestamp, 3
71
+ optional :string, :seqId, 4
72
+ end
73
+
74
+ class GtAuthResult < ::ProtocolBuffers::Message
75
+ # forward declarations
76
+
77
+ # enums
78
+ module GtAuthResultCode
79
+ include ::ProtocolBuffers::Enum
80
+
81
+ set_fully_qualified_name "GtReq.GtAuthResult.GtAuthResultCode"
82
+
83
+ Successed = 0
84
+ Failed_noSign = 1
85
+ Failed_noAppkey = 2
86
+ Failed_noTimestamp = 3
87
+ Failed_AuthIllegal = 4
88
+ Redirect = 5
89
+ end
90
+
91
+ set_fully_qualified_name "GtReq.GtAuthResult"
92
+
93
+ required :int32, :code, 1
94
+ optional :string, :redirectAddress, 2
95
+ optional :string, :seqId, 3
96
+ optional :string, :info, 4
97
+ end
98
+
99
+ class ReqServList < ::ProtocolBuffers::Message
100
+ set_fully_qualified_name "GtReq.ReqServList"
101
+
102
+ optional :string, :seqId, 1
103
+ required :int64, :timestamp, 3
104
+ end
105
+
106
+ class ReqServListResult < ::ProtocolBuffers::Message
107
+ # forward declarations
108
+
109
+ # enums
110
+ module ReqServHostResultCode
111
+ include ::ProtocolBuffers::Enum
112
+
113
+ set_fully_qualified_name "GtReq.ReqServListResult.ReqServHostResultCode"
114
+
115
+ Successed = 0
116
+ Failed = 1
117
+ Busy = 2
118
+ end
119
+
120
+ set_fully_qualified_name "GtReq.ReqServListResult"
121
+
122
+ required :int32, :code, 1
123
+ repeated :string, :host, 2
124
+ optional :string, :seqId, 3
125
+ end
126
+
127
+ class PushListResult < ::ProtocolBuffers::Message
128
+ set_fully_qualified_name "GtReq.PushListResult"
129
+
130
+ repeated ::GtReq::PushResult, :results, 1
131
+ end
132
+
133
+ class PushResult < ::ProtocolBuffers::Message
134
+ # forward declarations
135
+
136
+ # enums
137
+ module EPushResult
138
+ include ::ProtocolBuffers::Enum
139
+
140
+ set_fully_qualified_name "GtReq.PushResult.EPushResult"
141
+
142
+ Successed_online = 0
143
+ Successed_offline = 1
144
+ Successed_ignore = 2
145
+ Failed = 3
146
+ Busy = 4
147
+ Success_startBatch = 5
148
+ Success_endBatch = 6
149
+ end
150
+
151
+ set_fully_qualified_name "GtReq.PushResult"
152
+
153
+ required ::GtReq::PushResult::EPushResult, :result, 1
154
+ required :string, :taskId, 2
155
+ required :string, :messageId, 3
156
+ required :string, :seqId, 4
157
+ required :string, :target, 5
158
+ optional :string, :info, 6
159
+ optional :string, :traceId, 7
160
+ end
161
+
162
+ class PushOSSingleMessage < ::ProtocolBuffers::Message
163
+ set_fully_qualified_name "GtReq.PushOSSingleMessage"
164
+
165
+ required :string, :seqId, 1
166
+ required ::GtReq::OSMessage, :message, 2
167
+ required ::GtReq::Target, :target, 3
168
+ end
169
+
170
+ class PushMMPSingleMessage < ::ProtocolBuffers::Message
171
+ set_fully_qualified_name "GtReq.PushMMPSingleMessage"
172
+
173
+ required :string, :seqId, 1
174
+ required ::GtReq::MMPMessage, :message, 2
175
+ required ::GtReq::Target, :target, 3
176
+ end
177
+
178
+ class StartMMPBatchTask < ::ProtocolBuffers::Message
179
+ set_fully_qualified_name "GtReq.StartMMPBatchTask"
180
+
181
+ required ::GtReq::MMPMessage, :message, 1
182
+ required :int64, :expire, 2, :default => 72
183
+ optional :string, :seqId, 3
184
+ end
185
+
186
+ class StartOSBatchTask < ::ProtocolBuffers::Message
187
+ set_fully_qualified_name "GtReq.StartOSBatchTask"
188
+
189
+ required ::GtReq::OSMessage, :message, 1
190
+ required :int64, :expire, 2, :default => 72
191
+ end
192
+
193
+ class PushListMessage < ::ProtocolBuffers::Message
194
+ set_fully_qualified_name "GtReq.PushListMessage"
195
+
196
+ required :string, :seqId, 1
197
+ required :string, :taskId, 2
198
+ repeated ::GtReq::Target, :targets, 3
199
+ end
200
+
201
+ class EndBatchTask < ::ProtocolBuffers::Message
202
+ set_fully_qualified_name "GtReq.EndBatchTask"
203
+
204
+ required :string, :taskId, 1
205
+ optional :string, :seqId, 2
206
+ end
207
+
208
+ class PushMMPAppMessage < ::ProtocolBuffers::Message
209
+ set_fully_qualified_name "GtReq.PushMMPAppMessage"
210
+
211
+ required ::GtReq::MMPMessage, :message, 1
212
+ repeated :string, :appIdList, 2
213
+ repeated :string, :phoneTypeList, 3
214
+ repeated :string, :provinceList, 4
215
+ optional :string, :seqId, 5
216
+ end
217
+
218
+ class ServerNotify < ::ProtocolBuffers::Message
219
+ # forward declarations
220
+
221
+ # enums
222
+ module NotifyType
223
+ include ::ProtocolBuffers::Enum
224
+
225
+ set_fully_qualified_name "GtReq.ServerNotify.NotifyType"
226
+
227
+ Normal = 0
228
+ ServerListChanged = 1
229
+ Exception = 2
230
+ end
231
+
232
+ set_fully_qualified_name "GtReq.ServerNotify"
233
+
234
+ required ::GtReq::ServerNotify::NotifyType, :type, 1
235
+ optional :string, :info, 2
236
+ optional :bytes, :extradata, 3
237
+ optional :string, :seqId, 4
238
+ end
239
+
240
+ class ServerNotifyResult < ::ProtocolBuffers::Message
241
+ set_fully_qualified_name "GtReq.ServerNotifyResult"
242
+
243
+ required :string, :seqId, 1
244
+ optional :string, :info, 2
245
+ end
246
+
247
+ class OSMessage < ::ProtocolBuffers::Message
248
+ set_fully_qualified_name "GtReq.OSMessage"
249
+
250
+ required :bool, :isOffline, 2
251
+ required :int64, :offlineExpireTime, 3, :default => 1
252
+ optional ::GtReq::Transparent, :transparent, 4
253
+ optional :string, :extraData, 5
254
+ optional :int32, :msgType, 6
255
+ optional :int32, :msgTraceFlag, 7
256
+ optional :int32, :priority, 8
257
+ end
258
+
259
+ class MMPMessage < ::ProtocolBuffers::Message
260
+ set_fully_qualified_name "GtReq.MMPMessage"
261
+
262
+ optional ::GtReq::Transparent, :transparent, 2
263
+ optional :string, :extraData, 3
264
+ optional :int32, :msgType, 4
265
+ optional :int32, :msgTraceFlag, 5
266
+ optional :int64, :msgOfflineExpire, 6
267
+ optional :bool, :isOffline, 7, :default => true
268
+ optional :int32, :priority, 8
269
+ end
270
+
271
+ class Transparent < ::ProtocolBuffers::Message
272
+ set_fully_qualified_name "GtReq.Transparent"
273
+
274
+ required :string, :id, 1
275
+ required :string, :action, 2
276
+ required :string, :taskId, 3
277
+ required :string, :appKey, 4
278
+ required :string, :appId, 5
279
+ required :string, :messageId, 6
280
+ optional ::GtReq::PushInfo, :pushInfo, 7
281
+ repeated ::GtReq::ActionChain, :actionChain, 8
282
+ end
283
+
284
+ class PushInfo < ::ProtocolBuffers::Message
285
+ set_fully_qualified_name "GtReq.PushInfo"
286
+
287
+ optional :string, :message, 1
288
+ optional :string, :actionKey, 2
289
+ optional :string, :sound, 3
290
+ optional :string, :badge, 4
291
+ optional :string, :payload, 5
292
+ optional :string, :locKey, 6
293
+ optional :string, :locArgs, 7
294
+ optional :string, :actionLocKey, 8
295
+ optional :string, :launchImage, 9
296
+ end
297
+
298
+ class ActionChain < ::ProtocolBuffers::Message
299
+ # forward declarations
300
+
301
+ # enums
302
+ module Type
303
+ include ::ProtocolBuffers::Enum
304
+
305
+ set_fully_qualified_name "GtReq.ActionChain.Type"
306
+
307
+ Goto = 0
308
+ Notification = 1
309
+ Popup = 2
310
+ Startapp = 3
311
+ Startweb = 4
312
+ Smsinbox = 5
313
+ Checkapp = 6
314
+ Eoa = 7
315
+ Appdownload = 8
316
+ Startsms = 9
317
+ Httpproxy = 10
318
+ Smsinbox2 = 11
319
+ Mmsinbox2 = 12
320
+ Popupweb = 13
321
+ Dial = 14
322
+ Reportbindapp = 15
323
+ Reportaddphoneinfo = 16
324
+ Reportapplist = 17
325
+ Terminatetask = 18
326
+ Reportapp = 19
327
+ Enablelog = 20
328
+ Disablelog = 21
329
+ Uploadlog = 22
330
+ end
331
+
332
+ set_fully_qualified_name "GtReq.ActionChain"
333
+
334
+ required :int32, :actionId, 1
335
+ required ::GtReq::ActionChain::Type, :type, 2
336
+ optional :int32, :next, 3
337
+ optional :string, :logo, 100
338
+ optional :string, :logoURL, 101
339
+ optional :string, :title, 102
340
+ optional :string, :text, 103
341
+ optional :bool, :clearable, 104
342
+ optional :bool, :ring, 105
343
+ optional :bool, :buzz, 106
344
+ optional :string, :bannerURL, 107
345
+ optional :string, :img, 120
346
+ repeated ::GtReq::Button, :buttons, 121
347
+ optional :string, :appid, 140
348
+ optional ::GtReq::AppStartUp, :appstartupid, 141
349
+ optional :bool, :autostart, 142
350
+ optional :int32, :failedAction, 143
351
+ optional :string, :url, 160
352
+ optional :string, :withcid, 161
353
+ optional :bool, :is_withnettype, 162, :default => false
354
+ optional :string, :address, 180
355
+ optional :string, :content, 181
356
+ optional :int64, :ct, 182
357
+ optional ::GtReq::SMSStatus, :flag, 183
358
+ optional :int32, :successedAction, 200
359
+ optional :int32, :uninstalledAction, 201
360
+ optional :string, :name, 220
361
+ optional :bool, :autoInstall, 223
362
+ optional :bool, :wifiAutodownload, 225
363
+ optional :bool, :forceDownload, 226
364
+ optional :bool, :showProgress, 227
365
+ optional :string, :post, 241
366
+ optional :string, :headers, 242
367
+ optional :bool, :groupable, 260
368
+ optional :string, :mmsTitle, 280
369
+ optional :string, :mmsURL, 281
370
+ optional :bool, :preload, 300
371
+ optional :string, :taskid, 320
372
+ optional :int64, :duration, 340
373
+ optional :string, :date, 360
374
+ end
375
+
376
+ class AppStartUp < ::ProtocolBuffers::Message
377
+ set_fully_qualified_name "GtReq.AppStartUp"
378
+
379
+ optional :string, :android, 1
380
+ optional :string, :symbia, 2
381
+ optional :string, :ios, 3
382
+ end
383
+
384
+ class Button < ::ProtocolBuffers::Message
385
+ set_fully_qualified_name "GtReq.Button"
386
+
387
+ optional :string, :text, 1
388
+ optional :int32, :next, 2
389
+ end
390
+
391
+ class Target < ::ProtocolBuffers::Message
392
+ set_fully_qualified_name "GtReq.Target"
393
+
394
+ required :string, :appId, 1
395
+ required :string, :clientId, 2
396
+ end
397
+
398
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gt_req
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - dfp
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby-protocol-buffers
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.6'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
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.11'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.11'
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
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '5.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '5.0'
69
+ description: ruby-sdk of igetui.com push notification service
70
+ email:
71
+ - dangfeipeng@gmail.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - ".travis.yml"
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - bin/console
83
+ - bin/setup
84
+ - gt_req.gemspec
85
+ - lib/gt_req.rb
86
+ - lib/gt_req/igt_message.rb
87
+ - lib/gt_req/igt_push.rb
88
+ - lib/gt_req/igt_target.rb
89
+ - lib/gt_req/template/abstract_template.rb
90
+ - lib/gt_req/template/notification_template.rb
91
+ - lib/gt_req/template/transmission_template.rb
92
+ - lib/gt_req/template/validate.rb
93
+ - lib/gt_req/version.rb
94
+ - lib/protobuf/GtReq.pb.rb
95
+ homepage: ''
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.4.7
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: igetui ruby sdk.
119
+ test_files: []
120
+ has_rdoc: