xiaomi-push 0.2.4 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,60 @@
1
+ module Xiaomi
2
+ module Push
3
+ module Services
4
+ # 用户查询类 API
5
+ #
6
+ # 比如查找用户设置的 Alias 和 Topic 等
7
+ # @attr [Client] context
8
+ class User
9
+ attr_reader :context
10
+
11
+ # 初始化
12
+ #
13
+ # @param [Client] context
14
+ def initialize(context)
15
+ @context = context
16
+ end
17
+
18
+ # def reg_id(alias)
19
+ # # url = @context.build_uri('reg_id/all') + "?alias=#{alias}"
20
+ # # r = HTTP.headers(@header).get url
21
+ # # JSON.parse(r)
22
+ # end
23
+
24
+ # 根据 reg id 查找绑定的别名(aliases)
25
+ #
26
+ # 一个 reg id 可以绑定多个 alias
27
+ #
28
+ # @param [String] reg_id
29
+ # @param [String] package_name
30
+ # @return [Hash] 小米返回数据结构
31
+ def aliases(reg_id, package_name = nil)
32
+ url = @context.build_uri('alias/all')
33
+ @context.get(url, reg_params(reg_id, package_name))
34
+ end
35
+
36
+ # 根据 reg id 查找设置的标签(Topics)
37
+ #
38
+ # 一个 reg id 可以绑定多个 topic
39
+ #
40
+ # @param [String] reg_id
41
+ # @param [String] package_name
42
+ # @return [Hash] 小米返回数据结构
43
+ def topices(reg_id, package_name = nil)
44
+ url = @context.build_uri('topic/all')
45
+ @context.get(url, reg_params(reg_id, package_name))
46
+ end
47
+
48
+ private
49
+
50
+ def reg_params(reg_id, package_name = nil)
51
+ {
52
+ registration_id: reg_id,
53
+ }.tap do |obj|
54
+ obj[:restricted_package_name] = package_name if package_name
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
@@ -1,5 +1,5 @@
1
1
  module Xiaomi
2
2
  module Push
3
- VERSION = '0.2.4'.freeze
3
+ VERSION = '0.3.0'.freeze
4
4
  end
5
5
  end
@@ -9,20 +9,20 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = ['icyleaf']
10
10
  spec.email = ['icyleaf.cn@gmail.com']
11
11
 
12
- spec.summary = 'MiPush Server SDK for Ruby'
13
- spec.description = 'MiPush Server SDK for Ruby'
12
+ spec.summary = '(unofficial) xiaomi push server sdk'
13
+ spec.description = '非官方小米推送服务端 Ruby SDK'
14
14
  spec.homepage = 'http://github.com/icyleaf/xiaomi-push'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_dependency 'rest-client', '>= 1.7.3'
21
- spec.add_dependency 'commander', '~> 4.3.2'
22
- spec.add_dependency 'multi_json', '~> 1.11.0'
20
+ spec.add_dependency 'http', '>= 2.0.0'
21
+ spec.add_dependency 'commander', '~> 4.4.3'
23
22
 
24
- spec.add_development_dependency 'bundler', '~> 1.9'
25
- spec.add_development_dependency 'rake', '~> 10.0'
26
- spec.add_development_dependency 'dotenv', '~> 2.0.1'
23
+ spec.add_development_dependency 'bundler'
24
+ spec.add_development_dependency 'rake'
27
25
  spec.add_development_dependency 'rspec'
26
+
27
+ spec.required_ruby_version = '>= 2.1.0'
28
28
  end
metadata CHANGED
@@ -1,99 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xiaomi-push
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - icyleaf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-12 00:00:00.000000000 Z
11
+ date: 2017-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rest-client
14
+ name: http
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.7.3
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.7.3
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: commander
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.3.2
33
+ version: 4.4.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.3.2
41
- - !ruby/object:Gem::Dependency
42
- name: multi_json
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 1.11.0
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 1.11.0
40
+ version: 4.4.3
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: bundler
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
- - - "~>"
45
+ - - ">="
60
46
  - !ruby/object:Gem::Version
61
- version: '1.9'
47
+ version: '0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - "~>"
52
+ - - ">="
67
53
  - !ruby/object:Gem::Version
68
- version: '1.9'
54
+ version: '0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '10.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '10.0'
83
- - !ruby/object:Gem::Dependency
84
- name: dotenv
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
59
+ - - ">="
88
60
  - !ruby/object:Gem::Version
89
- version: 2.0.1
61
+ version: '0'
90
62
  type: :development
91
63
  prerelease: false
92
64
  version_requirements: !ruby/object:Gem::Requirement
93
65
  requirements:
94
- - - "~>"
66
+ - - ">="
95
67
  - !ruby/object:Gem::Version
96
- version: 2.0.1
68
+ version: '0'
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: rspec
99
71
  requirement: !ruby/object:Gem::Requirement
@@ -108,7 +80,7 @@ dependencies:
108
80
  - - ">="
109
81
  - !ruby/object:Gem::Version
110
82
  version: '0'
111
- description: MiPush Server SDK for Ruby
83
+ description: 非官方小米推送服务端 Ruby SDK
112
84
  email:
113
85
  - icyleaf.cn@gmail.com
114
86
  executables:
@@ -116,9 +88,10 @@ executables:
116
88
  extensions: []
117
89
  extra_rdoc_files: []
118
90
  files:
91
+ - ".circleci/config.yml"
119
92
  - ".gitignore"
120
93
  - ".rspec"
121
- - ".travis.yml"
94
+ - CHANGELOG.md
122
95
  - Gemfile
123
96
  - README.md
124
97
  - Rakefile
@@ -128,17 +101,20 @@ files:
128
101
  - lib/xiaomi/push/commands.rb
129
102
  - lib/xiaomi/push/commands/feedback.rb
130
103
  - lib/xiaomi/push/commands/message.rb
104
+ - lib/xiaomi/push/commands/user.rb
131
105
  - lib/xiaomi/push/const.rb
132
- - lib/xiaomi/push/devices/android.rb
133
- - lib/xiaomi/push/devices/ios.rb
134
106
  - lib/xiaomi/push/error.rb
107
+ - lib/xiaomi/push/platforms/android.rb
108
+ - lib/xiaomi/push/platforms/ios.rb
135
109
  - lib/xiaomi/push/services/feedback.rb
110
+ - lib/xiaomi/push/services/job.rb
136
111
  - lib/xiaomi/push/services/message.rb
112
+ - lib/xiaomi/push/services/messages.rb
137
113
  - lib/xiaomi/push/services/messages/android.rb
138
114
  - lib/xiaomi/push/services/messages/base.rb
139
115
  - lib/xiaomi/push/services/messages/ios.rb
140
- - lib/xiaomi/push/services/multi_messages.rb
141
116
  - lib/xiaomi/push/services/topic.rb
117
+ - lib/xiaomi/push/services/user.rb
142
118
  - lib/xiaomi/push/version.rb
143
119
  - xiaomi-push.gemspec
144
120
  homepage: http://github.com/icyleaf/xiaomi-push
@@ -152,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
152
128
  requirements:
153
129
  - - ">="
154
130
  - !ruby/object:Gem::Version
155
- version: '0'
131
+ version: 2.1.0
156
132
  required_rubygems_version: !ruby/object:Gem::Requirement
157
133
  requirements:
158
134
  - - ">="
@@ -160,8 +136,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
136
  version: '0'
161
137
  requirements: []
162
138
  rubyforge_project:
163
- rubygems_version: 2.6.4
139
+ rubygems_version: 2.6.12
164
140
  signing_key:
165
141
  specification_version: 4
166
- summary: MiPush Server SDK for Ruby
142
+ summary: "(unofficial) xiaomi push server sdk"
167
143
  test_files: []
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.5
@@ -1,6 +0,0 @@
1
- module Xiaomi
2
- module Push
3
- class Android < Xiaomi::Push::Client
4
- end
5
- end
6
- end
@@ -1,9 +0,0 @@
1
- module Xiaomi
2
- module Push
3
- class IOS < Xiaomi::Push::Client
4
- end
5
-
6
- class Ios < Xiaomi::Push::Client
7
- end
8
- end
9
- end