ruby-for-xinge 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -3
- data/lib/xinge/base.rb +1 -1
- data/lib/xinge/ios.rb +5 -2
- data/lib/xinge/version.rb +1 -1
- 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: 6461c689e4fcebf0a666e3fd33f8db6d67dc2073
|
4
|
+
data.tar.gz: 22823d8d07bdf37dff638f7291bd8c15d441ac16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8eb3684aa90aede03a66db01906b70b23de2bc916e6499c22c140725815a7a929df893d848458d37ea8fc3f173246f557c90b6900fecb119893e9e4973299920
|
7
|
+
data.tar.gz: cfdbcfe6b55e4527fae1b45d9c7e0e032cb44e49d7609ef767157dd672e911fb3c229ce937fd3968bd9bd6b3d83ff3251bb5017debf29f4878b51adf74ed1a69
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ TODO: Delete this and the text above, and describe your gem
|
|
9
9
|
Add this line to your application's Gemfile:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'xinge'
|
12
|
+
gem 'ruby-for-xinge'
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
@@ -18,11 +18,21 @@ And then execute:
|
|
18
18
|
|
19
19
|
Or install it yourself as:
|
20
20
|
|
21
|
-
$ gem install xinge
|
21
|
+
$ gem install ruby-for-xinge
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Add below codes to your application.rb or a init file in config/initializers
|
26
|
+
|
27
|
+
require 'xinge'
|
28
|
+
Xinge.configure do |config|
|
29
|
+
config[:android_accessId] = Your android access id
|
30
|
+
config[:android_secretKey] = 'Your secret key xxx'
|
31
|
+
config[:ios_accessId] = Your ios access id
|
32
|
+
config[:ios_secretKey] = 'Your secret key xxx'
|
33
|
+
config[:env] = Rails.env # if you are not in a rails app, you can set it config[:env]='development' or config[:env]='production', it is 'development' default.
|
34
|
+
end
|
35
|
+
|
26
36
|
|
27
37
|
## Development
|
28
38
|
|
data/lib/xinge/base.rb
CHANGED
data/lib/xinge/ios.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
require 'xinge/base'
|
2
2
|
module Xinge
|
3
3
|
class Ios < Base
|
4
|
+
|
5
|
+
ENV_MAP = {'production' => 1, 'development' => 2}
|
6
|
+
|
4
7
|
def initialize(accessId = nil, secretKey = nil, options = {})
|
5
8
|
super
|
6
9
|
end
|
7
10
|
def pushToSingleDevice(token, title, content, params={})
|
8
|
-
self.push_single_device(token, 1, build_simple_message(title, content), {environment:
|
11
|
+
self.push_single_device(token, 1, build_simple_message(title, content), {environment: ENV_MAP[Xinge.config[:env]]})
|
9
12
|
end
|
10
13
|
def pushToAllDevice(title, content, params={})
|
11
|
-
self.push_all_device(1, build_simple_message(title, content), {environment:
|
14
|
+
self.push_all_device(1, build_simple_message(title, content), {environment: ENV_MAP[Xinge.config[:env]]})
|
12
15
|
end
|
13
16
|
|
14
17
|
protected
|
data/lib/xinge/version.rb
CHANGED