coorasse / passkit

Wallet Pass generation for Ruby On Rails
MIT License
89 stars 27 forks source link

How should we serve passes ? #12

Closed bilouw closed 6 months ago

bilouw commented 1 year ago

Hi,

First, thanks for this great gem ! I have a little problem:

I made custom passes in the dashboard previews that works fine and i can download them from my Iphone. When i try to serve the pass by url with the GeneratorUrl, the pass seems to be broken on my Iphone, but not on my Mac.

So this is my question: Should i generate an url to download the pass, or should i do like the preview page= a "send_file" from my rails server ?

I don't see the benefit of generating an url instead of having an endpoint to download the pass directly. (in an app context with auth).

My thought now is that the purpose of generating an url is for sending it by email for example. For an classic app with authenticated users, we could just make an endpoint like the preview in dashboard ?

I'm a wrong ?

Thanks :)

PS: After digging more in the gem, i found that the endpoint that was called with the generated link do the same thing: pass = Passkit::Factory.create_pass(passkit_klass, generator) send_file(pass)

Now my question is: Should i use this Factory to create my passes every time ? Or should i find the pass if it exists then create it if not ?

coorasse commented 1 year ago

Hi @bilouw , if you want to implement an endpoint yourself, you can look at https://github.com/coorasse/passkit/blob/main/app/controllers/passkit/api/v1/passes_controller.rb#L47, but you could also simply re-use the existing this passes_url endpoint.