nebulab / cangaroo

Connect Any App to Any Service
https://github.com/nebulab/cangaroo
MIT License
107 stars 18 forks source link

Using Wombat Extensions #5

Closed RML-Admin closed 8 years ago

RML-Admin commented 8 years ago

Hi - I am trying to figure out how to use Wombat integrations with Cangaroo. Could you provide some instructions or tutorials that can help me with this? I created a new rails app with postgresql DB, included cangaroo in Gemfile, ran migrations, and edited the routes.

Thanks Santi

bricesanchez commented 8 years ago

:+1: I've deployed the Wombat Shopify integration on Heroku and now i don't know how to connect it to my Cangaroo app.

iloveitaly commented 8 years ago

@adavanisanti @bricesanchez Have you created a Cangaroo::Connection and configured jobs? Could you provide some more information on what you have setup and where you are encountering issues?

bricesanchez commented 8 years ago

@iloveitaly and @adavanisanti,

@AlessioRocco helped me to figure out how to use the shopify_integration with Cangaroo.

Finally it's simple :

  1. Clone the shopify_integration and started it with the code into https://github.com/wombat/shopify_integration/blob/master/Procfile bundle exec unicorn -p 4000 -c ./config/unicorn.rb
  2. Create a product job inside your Cangaroo app :
# app/jobs/cangaroo/product_job.rb
module Cangaroo
  class ProductJob < Cangaroo::Job
    connection 'Shopify'
    path '/add_product'

    def transform
      {
        product: {
          id: 'SKUPRODUCT',
          name: "Burton Custom Freestlye 153",
          description: 'Descrizione',
          meta_description: "<strong>Good snowboard!<\/strong>",
          options: [
            "Snowboard"
          ]
        }
      }
    end
  end
end
  1. Add a Cangaroo::Connection like this in your rails console
 Cangaroo::Connection.create(
    name: 'Shopify',
    url: 'http://127.0.0.1:4000',
    key: '123',
    token: '123', 
    parameters: {
        :shopify_apikey=> "yourkey", 
        :shopify_password=>"yourpassword", 
        :shopify_host=>"yourhost"
    }
  )
  1. Then run this in your rails console
Cangaroo::ProductJob.perform_now

And :tada: you have a new product in your Shopify app

RML-Admin commented 8 years ago

@bricesanchez Thanks for the steps. This helped me understand the data flow.

AlessioRocco commented 8 years ago

@adavanisanti finally I had time to written a blogpost on how to using extensions http://nebulab.it/blog/integrate-your-solidus-store-with-external-services-using-cangaroo/. I close this issue in favor of this post.

bricesanchez commented 8 years ago

@AlessioRocco nice! Could you do the same with the PollJob ?