passbook 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +23 -23
- data/VERSION +1 -1
- data/lib/passbook.rb +1 -0
- data/passbook.gemspec +2 -3
- metadata +2 -3
- data/passbook-ios.gemspec +0 -87
data/README.md
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
[![Build Status](https://travis-ci.org/lgleasain/passbook.png)](https://travis-ci.org/lgleasain/passbook)
|
2
2
|
|
3
|
-
# passbook
|
3
|
+
# passbook
|
4
4
|
|
5
|
-
The passbook
|
5
|
+
The passbook gem let's you create a pkpass for passbook in iOS 6+
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
Include the passbook
|
9
|
+
Include the passbook gem in your project.
|
10
10
|
|
11
|
-
IE: In your Gemfile
|
11
|
+
IE: In your Gemfile
|
12
12
|
```
|
13
|
-
gem 'passbook
|
13
|
+
gem 'passbook'
|
14
14
|
```
|
15
15
|
|
16
16
|
## Configuration
|
@@ -22,7 +22,7 @@ Create initializer
|
|
22
22
|
rails g passbook:config [Absolute path to the wwdc cert file] [Absolute path to your cert.p12 file] [Password for your certificate]
|
23
23
|
```
|
24
24
|
|
25
|
-
Configure your config/initializers/passbook.rb
|
25
|
+
Configure your config/initializers/passbook.rb
|
26
26
|
```
|
27
27
|
Passbook.configure do |passbook|
|
28
28
|
passbook.wwdc_cert = Rails.root.join('wwdc_cert.pem')
|
@@ -44,7 +44,7 @@ If you are using Sinatra you can place this in the file you are executing or in
|
|
44
44
|
|
45
45
|
If You are doing push notifications then you will need to add some extra configuration options, namely a push notification certificate and a notification gateway certificate. Look at the Grocer gem documentation to find information on how to create this certificate. Settings you will want ot use for the notification gateway are either 'gateway.push.apple.com' for production, 'gateway.sandbox.push.apple.com' for developmetn and 'localhost' for unit tests.
|
46
46
|
```
|
47
|
-
Passbook.configure do |passbook|
|
47
|
+
Passbook.configure do |passbook|
|
48
48
|
.....other settings.....
|
49
49
|
passbook.notification_gateway = 'gateway.push.apple.com'
|
50
50
|
passbook.notification_cert = 'lib/assets/my_notification_cert.pem'
|
@@ -115,7 +115,7 @@ We will try to make this cleaner in subsequent releases.
|
|
115
115
|
|
116
116
|
### Passbook
|
117
117
|
|
118
|
-
If you want to support passbook push notification updates you will need to congigure the appropriate bits above.
|
118
|
+
If you want to support passbook push notification updates you will need to congigure the appropriate bits above.
|
119
119
|
|
120
120
|
In order to support push notifications you will need to have a basic understanding of the way that push notifications work and how the data is passed back and forth. See [this](http://developer.apple.com/library/ios/#Documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Creating.html) for basic information about passes and [this](http://developer.apple.com/library/ios/#Documentation/UserExperience/Conceptual/PassKit_PG/Chapters/Updating.html#//apple_ref/doc/uid/TP40012195-CH5-SW1) to understand the information that needs to be exchanged between each device and your application to support the update service.
|
121
121
|
|
@@ -125,7 +125,7 @@ Your pass will need to have a field called 'webServiceURL' with the base url to
|
|
125
125
|
...
|
126
126
|
"webserviceURL" : "https://www.honeybadgers.com/",
|
127
127
|
"authenticationToken" : "yummycobras"
|
128
|
-
...
|
128
|
+
...
|
129
129
|
```
|
130
130
|
|
131
131
|
Passbook-ios includes rack middleware to make the job of supporting the passbook endpoints easier. You will need to configure the middleware as outlined above and then implement a class called Passbook::PassbookNotification. Below is an annotated implementation.
|
@@ -136,15 +136,15 @@ module Passbook
|
|
136
136
|
|
137
137
|
# This is called whenever a new pass is saved to a users passbook or the
|
138
138
|
# notifications are re-enabled. You will want to persist these values to
|
139
|
-
# allow for updates on subsequent calls in the call chain. You can have
|
140
|
-
# multiple push tokens and serial numbers for a specific
|
139
|
+
# allow for updates on subsequent calls in the call chain. You can have
|
140
|
+
# multiple push tokens and serial numbers for a specific
|
141
141
|
# deviceLibraryIdentifier.
|
142
142
|
|
143
143
|
def self.register_pass(options)
|
144
144
|
the_passes_serial_number = options['serialNumber']
|
145
145
|
the_devices_device_library_identifier = options['deviceLibraryIdentifier']
|
146
146
|
the_devices_push_token = options['pushToken']
|
147
|
-
|
147
|
+
|
148
148
|
# this is if the pass registered successfully
|
149
149
|
# change the code to 200 if the pass has already been registered
|
150
150
|
# or another appropriate code if something went wrong.
|
@@ -152,14 +152,14 @@ module Passbook
|
|
152
152
|
end
|
153
153
|
|
154
154
|
# This is called when the device receives a push notification from apple.
|
155
|
-
# You will need to return the serial number of all passes associated with
|
155
|
+
# You will need to return the serial number of all passes associated with
|
156
156
|
# that deviceLibraryIdentifier.
|
157
|
-
|
157
|
+
|
158
158
|
def self.passes_for_device(options)
|
159
159
|
device_library_identifier = options['deviceLibraryIdentifier']
|
160
|
-
|
160
|
+
|
161
161
|
# the 'lastUpdated' uses integers values to tell passbook if the pass is
|
162
|
-
# more recent than the current one. If you just set it is the same value
|
162
|
+
# more recent than the current one. If you just set it is the same value
|
163
163
|
# every time the pass will update and you will get a warning in the log files.
|
164
164
|
# you can use the time in milliseconds, a counter or any other numbering scheme.
|
165
165
|
# you then also need to return an array of serial numbers.
|
@@ -178,10 +178,10 @@ module Passbook
|
|
178
178
|
# this returns your updated pass
|
179
179
|
def self.latest_pass(options)
|
180
180
|
the_pass_serial_number = options['serialNumber']
|
181
|
-
# create your PkPass the way you did when your first created the pass.
|
182
|
-
# you will want to return
|
181
|
+
# create your PkPass the way you did when your first created the pass.
|
182
|
+
# you will want to return
|
183
183
|
my_pass = PkPass.new 'your pass json'
|
184
|
-
# you will want to return the string from the stream of your PkPass object.
|
184
|
+
# you will want to return the string from the stream of your PkPass object.
|
185
185
|
mypass.stream.string
|
186
186
|
end
|
187
187
|
|
@@ -194,21 +194,21 @@ module Passbook
|
|
194
194
|
|
195
195
|
end
|
196
196
|
end
|
197
|
-
|
197
|
+
|
198
198
|
```
|
199
199
|
|
200
200
|
To send a push notification for a updated pass simply call Passbook::PassbookPushNotification.send_notifications_for_promotion with the push token for the pass you are updating
|
201
201
|
|
202
202
|
```
|
203
203
|
Passbook::PassbookPushNotification.send_notifications_for_promotion the_pass_push_token
|
204
|
-
|
204
|
+
|
205
205
|
```
|
206
206
|
|
207
207
|
Apple will send out a notification to your phone (usually within 15 minutes or less), which will cause the phone that this push notification is associated with to make a call to your server to get pass serial numbers and to then get the updated pass. Each phone/pass combination has it's own push token whch will require a separate call for every phone that has push notifications enabled for a pass (this is an Apple thing). In the future we may look into offering background process support for this as part of this gem. For now, if you have a lot of passes to update you will need to do this yourself.
|
208
208
|
|
209
209
|
## Tests
|
210
210
|
|
211
|
-
To launch tests :
|
211
|
+
To launch tests :
|
212
212
|
```
|
213
213
|
bundle exec rspec spec/lib/passbook/pkpass_spec.rb
|
214
214
|
```
|
@@ -232,6 +232,6 @@ Adding support for push notification updates for passes.
|
|
232
232
|
License
|
233
233
|
-------
|
234
234
|
|
235
|
-
passbook
|
235
|
+
passbook is released under the MIT license:
|
236
236
|
|
237
237
|
* http://www.opensource.org/licenses/MIT
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/passbook.rb
CHANGED
@@ -3,6 +3,7 @@ require "passbook/pkpass"
|
|
3
3
|
require 'active_support/core_ext/module/attribute_accessors'
|
4
4
|
require 'passbook/push_notification'
|
5
5
|
require 'grocer/passbook_notification'
|
6
|
+
require 'rack/passbook_rack'
|
6
7
|
|
7
8
|
module Passbook
|
8
9
|
mattr_accessor :p12_cert, :p12_password, :wwdc_cert, :p12_certificate, :p12_key, :notification_cert, :notification_gateway
|
data/passbook.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "passbook"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Thomas Lauro", "Lance Gleason"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-03-08"
|
13
13
|
s.description = "This gem allows you to create IOS Passbooks. Unlike some, this works with Rails but does not require it."
|
14
14
|
s.email = ["thomas@lauro.fr", "lgleason@polyglotprogramminginc.com"]
|
15
15
|
s.extra_rdoc_files = [
|
@@ -31,7 +31,6 @@ Gem::Specification.new do |s|
|
|
31
31
|
"lib/rack/passbook_rack.rb",
|
32
32
|
"lib/rails/generators/passbook/config/config_generator.rb",
|
33
33
|
"lib/rails/generators/passbook/config/templates/initializer.rb",
|
34
|
-
"passbook-ios.gemspec",
|
35
34
|
"passbook.gemspec",
|
36
35
|
"spec/data/icon.png",
|
37
36
|
"spec/data/icon@2x.png",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passbook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-03-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rubyzip
|
@@ -181,7 +181,6 @@ files:
|
|
181
181
|
- lib/rack/passbook_rack.rb
|
182
182
|
- lib/rails/generators/passbook/config/config_generator.rb
|
183
183
|
- lib/rails/generators/passbook/config/templates/initializer.rb
|
184
|
-
- passbook-ios.gemspec
|
185
184
|
- passbook.gemspec
|
186
185
|
- spec/data/icon.png
|
187
186
|
- spec/data/icon@2x.png
|
data/passbook-ios.gemspec
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "passbook-ios"
|
8
|
-
s.version = "0.2.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Thomas Lauro", "Lance Gleason"]
|
12
|
-
s.date = "2013-01-06"
|
13
|
-
s.description = "This gem allows you to create IOS Passbooks. Unlike some, this works with Rails but does not require it."
|
14
|
-
s.email = ["thomas@lauro.fr", "lgleason@polyglotprogramminginc.com"]
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".travis.yml",
|
21
|
-
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
|
-
"LICENSE",
|
24
|
-
"README.md",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"lib/passbook.rb",
|
28
|
-
"lib/passbook/pkpass.rb",
|
29
|
-
"lib/passbook/push_notification.rb",
|
30
|
-
"lib/passbook/version.rb",
|
31
|
-
"lib/rack/passbook_rack.rb",
|
32
|
-
"lib/rails/generators/passbook/config/config_generator.rb",
|
33
|
-
"lib/rails/generators/passbook/config/templates/initializer.rb",
|
34
|
-
"passbook-ios.gemspec",
|
35
|
-
"passbook.gemspec",
|
36
|
-
"spec/data/icon.png",
|
37
|
-
"spec/data/icon@2x.png",
|
38
|
-
"spec/data/logo.png",
|
39
|
-
"spec/data/logo@2x.png",
|
40
|
-
"spec/lib/passbook/pkpass_spec.rb",
|
41
|
-
"spec/lib/passbook/push_notification_spec.rb",
|
42
|
-
"spec/lib/rack/passbook_rack_spec.rb",
|
43
|
-
"spec/spec_helper.rb"
|
44
|
-
]
|
45
|
-
s.homepage = "http://github.com/frozon/passbook"
|
46
|
-
s.licenses = ["MIT"]
|
47
|
-
s.require_paths = ["lib"]
|
48
|
-
s.rubygems_version = "1.8.24"
|
49
|
-
s.summary = "A IOS Passbook generator."
|
50
|
-
|
51
|
-
if s.respond_to? :specification_version then
|
52
|
-
s.specification_version = 3
|
53
|
-
|
54
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
55
|
-
s.add_runtime_dependency(%q<rubyzip>, [">= 0"])
|
56
|
-
s.add_runtime_dependency(%q<grocer>, [">= 0"])
|
57
|
-
s.add_development_dependency(%q<rack-test>, [">= 0"])
|
58
|
-
s.add_development_dependency(%q<activesupport>, [">= 0"])
|
59
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
60
|
-
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
61
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
62
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
63
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
64
|
-
else
|
65
|
-
s.add_dependency(%q<rubyzip>, [">= 0"])
|
66
|
-
s.add_dependency(%q<grocer>, [">= 0"])
|
67
|
-
s.add_dependency(%q<rack-test>, [">= 0"])
|
68
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
69
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
70
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
71
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
72
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
73
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
74
|
-
end
|
75
|
-
else
|
76
|
-
s.add_dependency(%q<rubyzip>, [">= 0"])
|
77
|
-
s.add_dependency(%q<grocer>, [">= 0"])
|
78
|
-
s.add_dependency(%q<rack-test>, [">= 0"])
|
79
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
80
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
81
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
82
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
83
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
84
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|