rfunduk / rails-stripe-connect-example

Example app of various bits and pieces needed to build a Stripe Connect app with Ruby on Rails.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Extract service objects into gems?

gkop opened this issue · comments

Thanks for this example project!

I'm surprised that there doesn't exist a gem that does the heavy-lifting done for example in https://github.com/rfunduk/rails-stripe-connect-example/blob/master/app/services/stripe_oauth.rb .

https://github.com/stripe/stripe-ruby doesn't touch oauth and https://github.com/isaacsanders/omniauth-stripe-connect is too opinionated.

I'm about to copy & paste your service object into my project, and feel ashamed ;)

That's a really interesting idea! I guess the main problem with extracting stripe_oauth.rb it is that it makes some pretty blatant assumptions about your User model. The OAuth parts are actually really minimal, and the rest is app specific. Of course, a lot of apps will have those same 'specifics', so I definitely see the potential here.

I wonder if it could be extended to be configurable in some simple ways to make it more flexible. That might help.

I'll do some thinking on this and consider what might be done to make this happen. In the meantime, I honestly wouldn't feel too bad about just copy/pasting it and adjusting for your app 😄