Created
November 21, 2019 17:12
-
-
Save victorgiraldes/e027021060baaa05e875df86290614de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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