frozon / passbook

Passbook gem let's you create pkpass for passbook iOS 6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sinatra with passbook has error....

rubyon opened this issue · comments

in my rails web...
in Gemfile

gem 'passbook', :git => 'git://github.com/frozon/passbook.git'

and works well!

but sinatra... ( I'm beginner in sinatra app dev)

require 'passbook'
require 'active_support/json/encoding'

has error...

no such file to load -- passbook

How can I do fix it??? plz... help me...

Hello,

Made some test:

Gemfile:

source :rubygems

gem 'sinatra'
gem 'active_support'
gem 'passbook', git: 'git://github.com/frozon/passbook.git'

test.rb

require 'rubygems'
require 'sinatra'
require 'active_support'
require 'passbook'

get '/pass.pkpass' do
  Passbook.wwdc_cert    = 'wwdc.pem'
  Passbook.p12_cert     = 'cert.p12'
  Passbook.p12_password = ''

  json = ''
  pass = Passbook::PKPass.new json
  pass.addFiles ['icon.png', 'icon@2x.png', 'logo.png', 'logo@2x.png', 'strip.png', 'strip@2x.png']

  response['Content-Type'] = 'application/vnd.apple.pkpass'
  attachment 'pass.pkpass'
  pass.stream
end

get '/' do
  '<a href="/pass.pkpass">Download pass</a>'
end

This is working for me, I ran bundle and bundle exec ruby test.rb

Thanks! It is solved!!! Thanks!!!

You're welcome