Skip to content

Instantly share code, notes, and snippets.

@victorgiraldes
Created November 21, 2019 17:12
Show Gist options
  • Save victorgiraldes/e027021060baaa05e875df86290614de to your computer and use it in GitHub Desktop.
Save victorgiraldes/e027021060baaa05e875df86290614de to your computer and use it in GitHub Desktop.
require 'rest-client'
module Services
module Webhook
class Base
attr_accessor :url
def initialize
@url = 'http://localhost:3000/api/v1'
end
def http_post(params)
begin
RestClient.post(@url, params.to_json, self.header)
rescue StandardError => err
err.response
end
end
def http_get
begin
RestClient.get(@url, self.header)
rescue StandardError => err
err.response
end
end
def header
{
content_type: :json,
accept: :json
}
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment