ionic_push 0.2.2 → 0.2.3
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/README.md +3 -3
- data/lib/ionic_push.rb +3 -1
- data/lib/ionic_push/push.rb +1 -17
- data/lib/ionic_push/push/notification.rb +25 -0
- data/lib/ionic_push/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 539241dfcfc194b46080ec011a76b46d7991dc8d
|
4
|
+
data.tar.gz: 4c69de932d21b16bc589fb258f60db3aaab7d812
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df7fbf2fafc67e941d172351c3d05195022ae595ae13775997ce6bbc9f0c84469571ba2bb99dd43788434504ac6e7fc6d04559ec502f94e1caa450125b4c78ff
|
7
|
+
data.tar.gz: 5e7f3f1c160047ef1db6cc349dab4008dbc3b8f73261d76bd58095f927860147ab28d30e020f2c500fadf67bc7218f9f7ec0899816adb5bec7d51a949368345c
|
data/README.md
CHANGED
@@ -45,9 +45,9 @@ IonicPush.push(['your', 'devices', 'tokens'], {title: 'Push Title', message: 'Pu
|
|
45
45
|
## To do
|
46
46
|
|
47
47
|
- [x] Basic API Usage
|
48
|
+
- [x] Adding custom data to your notificaitons
|
48
49
|
- [ ] Sengind Push to Ionic User ID's
|
49
50
|
- [ ] Scheduling a push for later delivery
|
50
|
-
- [ ] Adding custom data to your notificaitons
|
51
51
|
- [ ] Phonegap Push plugin options
|
52
52
|
- [ ] Customizing Notification appearance
|
53
53
|
- [ ] Templating your push notification
|
@@ -57,11 +57,11 @@ IonicPush.push(['your', 'devices', 'tokens'], {title: 'Push Title', message: 'Pu
|
|
57
57
|
|
58
58
|
## Development
|
59
59
|
|
60
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake
|
60
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
61
61
|
|
62
62
|
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).
|
63
63
|
|
64
64
|
## Contributing
|
65
65
|
|
66
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
66
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kidush/ionic_push.
|
67
67
|
|
data/lib/ionic_push.rb
CHANGED
@@ -2,6 +2,8 @@ require 'ionic_push/version'
|
|
2
2
|
require 'ionic_push/configuration'
|
3
3
|
require 'ionic_push/base_uri'
|
4
4
|
require 'ionic_push/request'
|
5
|
+
|
6
|
+
require 'ionic_push/push/notification'
|
5
7
|
require 'ionic_push/push'
|
6
8
|
|
7
9
|
module IonicPush
|
@@ -15,7 +17,7 @@ module IonicPush
|
|
15
17
|
yield(configuration)
|
16
18
|
end
|
17
19
|
|
18
|
-
def self.push(tokens, notification_params
|
20
|
+
def self.push(tokens, notification_params)
|
19
21
|
notification(tokens, notification_params)
|
20
22
|
end
|
21
23
|
end
|
data/lib/ionic_push/push.rb
CHANGED
@@ -5,7 +5,7 @@ module IonicPush
|
|
5
5
|
end
|
6
6
|
|
7
7
|
module ClassMethods
|
8
|
-
def notification(tokens, notification_params
|
8
|
+
def notification(tokens, notification_params)
|
9
9
|
notification = Notification.new(tokens, notification_params)
|
10
10
|
req_push = IonicPush::Request.new(@configuration, notification.body)
|
11
11
|
|
@@ -13,21 +13,5 @@ module IonicPush
|
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
class Notification
|
17
|
-
def initialize(tokens, notification)
|
18
|
-
@tokens = tokens
|
19
|
-
@notification = notification
|
20
|
-
end
|
21
|
-
|
22
|
-
def body
|
23
|
-
{
|
24
|
-
tokens: @tokens,
|
25
|
-
notification: {
|
26
|
-
title: @notification[:title],
|
27
|
-
message: @notification[:message]
|
28
|
-
}
|
29
|
-
}
|
30
|
-
end
|
31
|
-
end
|
32
16
|
end
|
33
17
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module IonicPush
|
2
|
+
module Push
|
3
|
+
class Notification
|
4
|
+
attr_accessor :tokens, :notification
|
5
|
+
|
6
|
+
def initialize(tokens, notification = nil)
|
7
|
+
@tokens = tokens
|
8
|
+
@notification = notification
|
9
|
+
@options = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def body
|
13
|
+
raise ArgumentError, 'Notification params must be a Hash' unless @notification.respond_to?(:to_hash)
|
14
|
+
@options.merge!(device_tokens)
|
15
|
+
@options.merge!(notification: notification)
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def device_tokens
|
21
|
+
{ tokens: @tokens }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
data/lib/ionic_push/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ionic_push
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thiago F. Lins
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -161,6 +161,7 @@ files:
|
|
161
161
|
- lib/ionic_push/base_uri.rb
|
162
162
|
- lib/ionic_push/configuration.rb
|
163
163
|
- lib/ionic_push/push.rb
|
164
|
+
- lib/ionic_push/push/notification.rb
|
164
165
|
- lib/ionic_push/request.rb
|
165
166
|
- lib/ionic_push/version.rb
|
166
167
|
homepage: https://github.com/kidush/ionic_push
|