xtremelabs / xl-passbook-ruby

Apache License 2.0
16 stars 10 forks source link

Multiple Templates ? #5

Closed sfielder closed 12 years ago

sfielder commented 12 years ago

Hi Andrei,

I am trying to dynamically pass the pass_type_id via url param, added multiple templates to my project to and it seems that I am unable to load more than one in the Passbook::Config.instance.add_pkpass do |passbook| block.

If I add multiple passbook.pass_config items in the block it only uses the first one regardless of the pass_type_id params from the url.

Any thoughts on how to enable a more dynamic template selection?

Thank you

Scott

xtreme-andrei-dinin commented 12 years ago

Hi Scott, Using multiple pass_type_id/templates should be easy. Ability to generate multiple types of passes was a requirement for me. Are you using the latest version of the gem? Have you seen the tutorial video? http://www.youtube.com/watch?v=GeWFk1FvEKc

You can just run the second code generation call multiple times to create multiple pass types. Let me know if that helps!

Cheers, -Andrei

On Wed, Nov 21, 2012 at 2:31 PM, sfielder notifications@github.com wrote:

Hi Andrei,

I am trying to dynamically pass the pass_type_id via url param, added multiple templates to my project to and it seems that I am unable to load more than one in the Passbook::Config.instance.add_pkpass do |passbook| block.

If I add multiple passbook.pass_config items in the block it only uses the first one regardless of the pass_type_id params from the url.

Any thoughts on how to enable a more dynamic template selection?

Thank you

Scott

— Reply to this email directly or view it on GitHubhttps://github.com/xtremelabs/xl-passbook-ruby/issues/5.

[image: Description: Description: Description: Description: Description: Description: http://img809.imageshack.us/img809/4226/xlemail.png]http://www.xtremelabs.com/

--- Andrei Dinin

Agile Engineer

Xtreme Labs Inc.

andrei.dinin@xtremelabs.com

sfielder commented 12 years ago

thanks for the quick reply

here's what I am attempting to do - however when I call up get '/v1/passes/boardingpass' => 'Passbook::passes#get_pkpass', :defaults => { :pass_type_id => 'pass.test.boardingpass' } it only shows me generic which is listed first.

Passbook::Config.instance.add_pkpass do |passbook| passbook.pass_config["pass.test.generic"]={ "cert_path"=>"#{Rails.root}/data/certificates/generic.p12", "cert_password"=>"password", "template_path"=>"#{Rails.root}/data/templates/pass.test.generic", "class"=>"Pass" } passbook.pass_config["pass.test.boardingpass"]={ "cert_path"=>"#{Rails.root}/data/certificates/boardingpass.p12", "cert_password"=>"password", "template_path"=>"#{Rails.root}/data/templates/pass.test.boardingpass", "class"=>"Pass" } passbook.pass_config["pass.test.event"]={ "cert_path"=>"#{Rails.root}/data/certificates/event.p12", "cert_password"=>"password", "template_path"=>"#{Rails.root}/data/templates/pass.test.event", "class"=>"Pass" } passbook.pass_config["pass.test.coupon"]={ "cert_path"=>"#{Rails.root}/data/certificates/coupon.p12", "cert_password"=>"password", "template_path"=>"#{Rails.root}/data/templates/pass.test.coupon", "class"=>"Pass" }

end

Thanks for your help!

S

xtreme-andrei-dinin commented 12 years ago

You are using the same model for all of them (Pass, "class"=>"Pass"). The idea is to use separate models. In your case, you would have Generic, Boardingpass, Event, Coupon (you can obviously namespace them).

Cheers, -Andrei

xtreme-andrei-dinin commented 12 years ago

In general, there has to be 1 model for each pass_type_id

sfielder commented 12 years ago

Coolness thank you

S

On Wed, Nov 21, 2012 at 3:08 PM, xtreme-andrei-dinin < notifications@github.com> wrote:

You are using the same model for all of them (Pass, "class"=>"Pass"). The idea is to use separate models. In your case, you would have Generic, Boardingpass, Event, Coupon (you can obviously namespace them).

Cheers, -Andrei

— Reply to this email directly or view it on GitHubhttps://github.com/xtremelabs/xl-passbook-ruby/issues/5#issuecomment-10612250.

Regards,

Scott Fielder

sfielder commented 12 years ago

that makes sense - was trying to really keep the model paired down if possible

On Wed, Nov 21, 2012 at 3:12 PM, xtreme-andrei-dinin < notifications@github.com> wrote:

In general, there has to be 1 model for each pass_type_id

— Reply to this email directly or view it on GitHubhttps://github.com/xtremelabs/xl-passbook-ruby/issues/5#issuecomment-10612424.

Regards,

Scott Fielder

sfielder commented 12 years ago

any ideas why passes are saving correctly to the mac iphone simulator, but when I load it onto my iphone it displays correctly, but does not add correctly once I click the add button?

thanks again!

xtreme-andrei-dinin commented 12 years ago

It could be a number of reasons. 1) Did you check off "Allow http connection" in your developer options on device? check my video, I change the options on a phone there.

2) Did you follow all the steps for certificates?

Cheers, -Andrei

On Wed, Nov 21, 2012 at 9:41 PM, sfielder notifications@github.com wrote:

any ideas why passes are saving correctly to the mac iphone simulator, but when I load it onto my iphone it displays correctly, but does not add correctly once I click the add button?

thanks again!

— Reply to this email directly or view it on GitHubhttps://github.com/xtremelabs/xl-passbook-ruby/issues/5#issuecomment-10622087.

[image: Description: Description: Description: Description: Description: Description: http://img809.imageshack.us/img809/4226/xlemail.png]http://www.xtremelabs.com/

--- Andrei Dinin

Agile Engineer

Xtreme Labs Inc.

andrei.dinin@xtremelabs.com

xtreme-andrei-dinin commented 12 years ago

just added an FAQ for this. https://github.com/xtremelabs/xl-passbook-ruby/wiki/FAQs

sfielder commented 12 years ago

Awesome - solved the issue. It was webserviceURL

Thanks again!

On Thu, Nov 22, 2012 at 12:19 AM, xtreme-andrei-dinin < notifications@github.com> wrote:

just added an FAQ for this. https://github.com/xtremelabs/xl-passbook-ruby/wiki/FAQs

— Reply to this email directly or view it on GitHubhttps://github.com/xtremelabs/xl-passbook-ruby/issues/5#issuecomment-10624085.

Regards,

Scott Fielder