Sha256: a72f55434b9fad409858f9fd4d9ba5eab81073c6b67978309b972c5be1327d05
Contents?: true
Size: 1.21 KB
Versions: 2
Compression:
Stored size: 1.21 KB
Contents
module RDStation class Webhooks include HTTParty def initialize(authorization_header:) @authorization_header = authorization_header end def all response = self.class.get(base_url, headers: @authorization_header.to_h) ApiResponse.build(response) end def by_uuid(uuid) response = self.class.get(base_url(uuid), headers: @authorization_header.to_h) ApiResponse.build(response) end def create(payload) response = self.class.post(base_url, headers: @authorization_header.to_h, body: payload.to_json) ApiResponse.build(response) end def update(uuid, payload) response = self.class.put(base_url(uuid), headers: @authorization_header.to_h, body: payload.to_json) ApiResponse.build(response) end def delete(uuid) response = self.class.delete(base_url(uuid), headers: @authorization_header.to_h) return webhook_deleted_message unless response.body RDStation::ErrorHandler.new(response).raise_error end private def webhook_deleted_message { message: 'Webhook deleted successfuly!' } end def base_url(path = '') "https://api.rd.services/integrations/webhooks/#{path}" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rdstation-ruby-client-2.1.0 | lib/rdstation/webhooks.rb |
rdstation-ruby-client-2.0.0 | lib/rdstation/webhooks.rb |