Sha256: 9efa19958e788a8ba1585e407eaa36ea738752d329dcde6ca7bd9d1b549cd7ba

Contents?: true

Size: 1015 Bytes

Versions: 14

Compression:

Stored size: 1015 Bytes

Contents

module TrackerApi
  module Resources
    class Webhook
      include Shared::Base

      attribute :client

      attribute :kind, String
      attribute :project_id, Integer
      attribute :webhook_url, String
      attribute :webhook_version, String
      attribute :created_at, DateTime
      attribute :updated_at, DateTime

      class UpdateRepresenter < Representable::Decorator
        include Representable::JSON

        property :project_id
        property :webhook_url
        property :webhook_version
      end

      def delete
        raise ArgumentError, 'Can not delete a webhook with an unknown project_id.' if project_id.nil?

        Endpoints::Webhook.new(client).delete(self)
      end

      # Save changes to an existing Webhook.
      def save
        raise ArgumentError, 'Can not update a webhook with an unknown project_id.' if project_id.nil?

        Endpoints::Webhook.new(client).update(self, UpdateRepresenter.new(Webhook.new(self.dirty_attributes)))
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
tracker_api-1.16.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.15.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.14.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.13.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.12.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.11.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.10.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.9.1 lib/tracker_api/resources/webhook.rb
tracker_api-1.9.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.8.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.7.1 lib/tracker_api/resources/webhook.rb
tracker_api-1.7.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.6.0 lib/tracker_api/resources/webhook.rb
tracker_api-1.5.0 lib/tracker_api/resources/webhook.rb