Sha256: 01038a5d4b8e88351b14708ef38c6986804a1b4e6dfa27c23ad3566724a65514
Contents?: true
Size: 1.47 KB
Versions: 46
Compression:
Stored size: 1.47 KB
Contents
# frozen_string_literal: true require_relative '../api_resource' module ErpIntegration module Fulfil module Resources class Webhook < ApiResource self.model_name = 'ir.webhook' # Archives the webhook with the given ID. # @param id [Integer] The ID of the webhook to archive. # @return [Boolean] Whether the webhook was archived successfully or not. def archive(id) client.put("model/#{model_name}/archive", [[id]]) true rescue ErpIntegration::HttpError::BadRequest false # Workaround: Fulfil api does not return a json when status code is 200 # (a.k.a. "Ok") and faraday is having an error when trying to parse it. # Let's skip the parse error and move on. rescue Faraday::ParsingError true end # Restores the webhook with the given ID. # @param id [Integer] The ID of the webhook to be restored. # @return [Boolean] Whether the webhook was restored successfully or not. def restore(id) client.put("model/#{model_name}/restore", [[id]]) true rescue ErpIntegration::HttpError::BadRequest false # Workaround: Fulfil api does not return a json when status code is 200 # (a.k.a. "Ok") and faraday is having an error when trying to parse it. # Let's skip the parse error and move on. rescue Faraday::ParsingError true end end end end end
Version data entries
46 entries across 46 versions & 1 rubygems