This gem let's you create a mswallet for Wallet app in WP8+.
Include the passbook gem in your project. IE in your Gemfile
gem 'mswallet'
and execute:
$ bundle
Or manual install:
$ gem install mswallet
If you want to also support the update endpoint you will also need to include the Rack::MswalletRack middleware. In rails your config will look something like this.
config.middleware.use Rack::MswalletRack
Mswallet::Handler are used by default for update request handle. You can set custom class.
Mswallet.custom_rack_handler = MyCustomHandler
# или
Mswallet.configure do |m|
m.custom_rack_handler = MyCustomHandler
end
pass = Mswallet::Pass.new
pass['Kind'] = 'General'
pass['Id'] = '00001'
pass['DisplayName'] = 'Test wallet'
pass['IssuerDisplayName'] = 'Test wallet'
pass['HeaderColor'] = '#0000FF'
pass['BodyColor'] = '#FFFFFF'
properties = {}
properties['Header'] = {
'Property' => [
{
'Key' => 'Hd1',
'Name' => 'Header Text',
'Value' => 'Name'
},
{
'Key' => 'Hd2',
'Name' => 'Header Text2',
'Value' => nil #empty value:  
}
]
}
pass['DisplayProperties'] = properties
pass.add_file name: 'file1', content: 'fileContent1'
pass.add_file name: 'file2', content: 'fileContent2'
pass.add_locale 'ru-RU', { 'hello_world' => 'Привет мир' }
pass['WebServiceUrl'] = "http://localhost:3000/api"
pass['AuthenticationToken'] = 'secret_token'
mswallet = pass.file
send_file mswallet.path, type: 'application/vnd.ms.wallet', disposition: 'attachment', filename: "pass.mswallet"
# Or a stream
mswallet = pass.stream
send_data mswallet.string, type: 'application/vnd.ms.wallet', disposition: 'attachment', filename: "pass.mswallet"
- Fork it ( http://github.com/fuCtor/mswallet/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request