ruby-for-xinge 0.1.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bf0938647bfa808021c5ebd4348434211dd419a
4
- data.tar.gz: 713d3cb6c8dd18ed00e7829c7c0cc4df491384e8
3
+ metadata.gz: 6461c689e4fcebf0a666e3fd33f8db6d67dc2073
4
+ data.tar.gz: 22823d8d07bdf37dff638f7291bd8c15d441ac16
5
5
  SHA512:
6
- metadata.gz: 6447bb47cfb456e6d55110157e8b19626270cad98678bac88e0612bf2ee9c89fb7c8c050fa44e13e657899b9bcd004c6a7bb7aa90d394ce548aee04746ea1650
7
- data.tar.gz: e3dac25e33b38ba1eb36b012ca081ceb2cf8cf9f1b71dee7df0f52bc07fc53926995ed82c5cad89351b491a1643af129a4de5ad1ffe74ceaf22ca8b95992e459
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
- TODO: Write usage instructions here
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
@@ -3,7 +3,7 @@ require 'digest'
3
3
 
4
4
  module Xinge
5
5
 
6
- @xinge_config = {}
6
+ @xinge_config = {env: 'development'}
7
7
 
8
8
  class << self
9
9
  def configure
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: 2})
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: 2})
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
@@ -1,3 +1,3 @@
1
1
  module Xinge
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-for-xinge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robot Jiang