handy_apn 0.1.2 → 0.1.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 +76 -16
- data/handy_apn.gemspec +1 -2
- data/lib/handy_apn/version.rb +1 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb19442dc04a53bac67cae07ba2d52fbef8ffd0f
|
4
|
+
data.tar.gz: 344d067ee973b39b894f16aa536ba3c27c462501
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f89a39b01053e293c6855fc6c016a29d507793ae2c9561bb593e5e522f50120279a0e6c1ecf3a64333497a900cffefb78970ccc32bc2c21e0da43dd73911a23
|
7
|
+
data.tar.gz: c6202cecd97ad5bdbb7a07048d4854cc47fc50c9f63c348d6d250dca6fb9d0bd35933f9d4c9b752d79357f35cd628143d733bc68ccebae4e2e1e6d5306ebc161
|
data/README.md
CHANGED
@@ -18,26 +18,86 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
21
|
+
### Command Line
|
22
|
+
The handy_apn gem provides a command-line option (```handy_apn```) to test your certificates by sending message to the device.
|
23
|
+
|
24
|
+
To lists the commands available:
|
25
|
+
```sh
|
26
|
+
$ handy_apn -h
|
27
|
+
```
|
28
|
+
|
29
|
+
To send message to a device:
|
30
|
+
```sh
|
31
|
+
$ handy_apn -h push
|
32
|
+
|
33
|
+
push
|
34
|
+
|
35
|
+
Usage: handy_apn push TOKEN [...]
|
36
|
+
|
37
|
+
Examples:
|
38
|
+
|
39
|
+
# description
|
40
|
+
handy_apn push <token> -m "Hello, World"
|
41
|
+
|
42
|
+
Options:
|
43
|
+
-m, --alert ALERT Body of the alert to send in the push notification
|
44
|
+
-e, --environment ENV Environment to send push notification (production or development (default))
|
45
|
+
-c, --certificate CERTIFICATE Path to certificate (.pem) file
|
46
|
+
-p, --[no]-passphrase Prompt for a certificate passphrase
|
47
|
+
```
|
48
|
+
|
49
|
+
To send the message "Hello world" to the device using the production apple push notification service using the prodution pem file.
|
50
|
+
```sh
|
51
|
+
$ handy_apn push "f2ecca82 b48b7a38 5b838ece 3079ee6f 29f27163 d8407c1f 01f7298c 0a74bd7c" -m "Hello world" -e production -c aps_production.pem -p
|
52
|
+
```
|
53
|
+
|
54
|
+
### Rakefile
|
55
|
+
The handy_apn gem also provides a rake task to test your certificates by sending a message to the device.
|
56
|
+
|
57
|
+
Create a Rakefile:
|
58
|
+
```sh
|
59
|
+
$ vi Rakefile
|
60
|
+
```
|
61
|
+
Add the following code to the Rakefile.
|
62
|
+
```ruby
|
63
|
+
require "handy_apn/Rakefile"
|
64
|
+
```
|
65
|
+
|
66
|
+
Now lists the rake tasks
|
67
|
+
```sh
|
68
|
+
$ rake --tasks
|
69
|
+
$ rake apn:send_message[apn_pem_file_path,apn_pass_phrase,device_token,should_send_message_to_apn_prod,message_text]
|
70
|
+
```
|
71
|
+
Params:
|
72
|
+
|
73
|
+
* apn_pem_file_path - absolute location of the file along with file name
|
74
|
+
* apn_pass_phrase - passphrase for your pem file
|
75
|
+
* device_token - should be formed of 64 alphanumeric characters and separated by space after 8 characters as shown in example below.
|
76
|
+
* should_send_message_to_apn_prod - true would send to apple's production push notification service.
|
77
|
+
* message_text - Message you want to send
|
78
|
+
|
79
|
+
Example to test development certificate:
|
80
|
+
```sh
|
81
|
+
$ rake apn:send_message["/Users/blah/apn_certificates/aps_development.pem","blah","eb8328c8 3f42a4dd e7eb8e96 5535b0c7 653032eb 070e54d9 c55133a6 da32c94f",false,"Hello world"]
|
82
|
+
```
|
35
83
|
|
36
84
|
## How to create apple push notification certificate
|
37
85
|
|
38
|
-
|
86
|
+
1. Open you Keychain and request for a CertificateSigningRequest(CSR):
|
87
|
+

|
88
|
+
2. Create your CSR and **save it disk**:
|
89
|
+
3. Open **apple developer portal**, open your app id and enable push notification:
|
90
|
+
4. In apple developer portal, To create push notification developer certificate, Click Certificate, you will see this page, click Continue here:
|
91
|
+
5. Now upload the CSR created in step 2:
|
92
|
+
6. Once generated, click on download and save the file. The saved file would be named: "aps_development.cer":
|
93
|
+
7. Open the downloaded aps_development.cer file by double clicking. This would add the .cer to keychain. Now Select the **private key** and the **certificate** and right click and select ```Export 2 items```:
|
94
|
+
8. Selecting Export 2 items, will export it as .p12 file:
|
95
|
+
9. Now execute the following ```openssl``` command on the ```AppDemoPrivateKeyDevCerTogether.p12```:
|
96
|
+
|
97
|
+
```sh
|
98
|
+
$ openssl pkcs12 -in AppDemoPrivateKeyDevCerTogether.p12 -out push_notification_demo_apn_dev.pem -nodes -clcerts
|
99
|
+
```
|
39
100
|
|
40
|
-
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
|
41
101
|
|
42
102
|
## Development
|
43
103
|
|
data/handy_apn.gemspec
CHANGED
@@ -17,13 +17,12 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.add_dependency "coloured_logger"
|
18
18
|
spec.add_dependency "commander", "~> 4.1"
|
19
19
|
spec.add_dependency "json"
|
20
|
-
spec.add_dependency "houston"
|
21
20
|
|
22
21
|
spec.add_development_dependency "bundler", "~> 1.9"
|
23
22
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
23
|
spec.add_development_dependency "rspec"
|
25
24
|
|
26
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|docs)/}) }
|
27
26
|
spec.bindir = "bin"
|
28
27
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
29
28
|
spec.require_paths = ["lib"]
|
data/lib/handy_apn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handy_apn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sushma Satish
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: configatron
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: houston
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: bundler
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|