qqpush 0.0.4 → 0.0.5
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 +4 -4
- data/lib/qqpush/android.rb +6 -0
- data/lib/qqpush/general.rb +4 -2
- data/lib/qqpush/ios.rb +6 -0
- data/qqpush.gemspec +1 -1
- data/spec/general_spec.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54d266dee409110762f68730dfb908d4b96fce9e
|
4
|
+
data.tar.gz: 4537d3258b676f2c950c0141a5a92a6d33b35fd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4348564368dce86c2822641a8ee0577b141fabf07f06028ae4b727e427a7036622f5977f876c5f9f11bb202720e3774a11a7a11fca4438c9a2256bad1a073ea
|
7
|
+
data.tar.gz: ce927a2b0a887b978c50c7901f1adb29c65d174f429eabec5c5c1f8dab65238cfbead15e7dca809b9040a4f57b24a4c6c7fc8694692b7b17607b750e72f971b5
|
data/lib/qqpush/android.rb
CHANGED
data/lib/qqpush/general.rb
CHANGED
@@ -6,7 +6,7 @@ require 'yaml'
|
|
6
6
|
|
7
7
|
module QQpush
|
8
8
|
class General
|
9
|
-
attr_accessor :settings
|
9
|
+
attr_accessor :settings, :request_params
|
10
10
|
|
11
11
|
PROTOCAL = 'http'
|
12
12
|
ROOT_URL = 'openapi.xg.qq.com'
|
@@ -17,6 +17,7 @@ module QQpush
|
|
17
17
|
SERVICES.each do |param_class, param_methods|
|
18
18
|
param_methods.each do |param_method|
|
19
19
|
define_method("#{param_class}_#{param_method}") do |params = {}|
|
20
|
+
params = request_params unless params.any?
|
20
21
|
params[:param_request] = 'get'
|
21
22
|
request(
|
22
23
|
params.merge(param_class: param_class,
|
@@ -25,9 +26,10 @@ module QQpush
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
28
|
-
def initialize
|
29
|
+
def initialize(params = {})
|
29
30
|
@settings =
|
30
31
|
File.exist?('settings.yml') ? YAML.load_file('settings.yml') : {}
|
32
|
+
@request_params = params
|
31
33
|
end
|
32
34
|
|
33
35
|
def request(params = {})
|
data/lib/qqpush/ios.rb
CHANGED
data/qqpush.gemspec
CHANGED
data/spec/general_spec.rb
CHANGED
@@ -17,8 +17,9 @@ describe 'General methods' do
|
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'can push to single device' do
|
20
|
-
|
21
|
-
message_type: 1, message: { content: 'content', title: 'title' }
|
20
|
+
@request.request_params =
|
21
|
+
{ message_type: 1, message: { content: 'content', title: 'title' } }
|
22
|
+
response = @request.push_single_device
|
22
23
|
expect(response['ret_code']).to eq(-1)
|
23
24
|
expect(response['err_msg']).to eq('param device_token error!')
|
24
25
|
end
|