Passbook gem let's you create pkpass for passbook iOS 6
TODO : push the gem to rubygems.org
Create initializer
rails g passbook:config
or with params
rails g passbook:config [Absolute path to your cert.p12 file] [Password for your certificate]
Configure your config/initializers/passbook.rb
Passbook.configure do |passbook|
passbook.p12_cert = Rails.root.join("cert.p12")
passbook.p12_password = 'cert password'
end
Please refer to apple iOS dev center for how to build cert and json
pass = Passbook::PKPass.new 'your json data'
# Add file from disk
pass.addFile 'file_path'
# Add file from memory
file[:name] = 'file name'
file[:content] = 'whatever you want'
pass.addFile file
# Add multiple files
pass.addFiles [file_path_1, file_path_2, file_path_3]
# Add multiple files from memory
pass.addFiles [{name: 'file1', content: 'content1'}, {name: 'file2', content: 'content2'}, {name: 'file3', content: 'content3'}]
pkpass_path = pass.create
send_file pkpass_path, type: 'application/vnd.apple.pkpass', disposition: 'attachment', filename: "pass.pkpass"
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Added some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request