Sha256: 0ccd0e0806fe2a8fce01fdfa59a6e42746ed988c0a405a0037ec74069234fd9f

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 Bytes

Contents

module Remetric
  class RESTEndpoint < Remetric::Endpoint
    def initialize(resource, client)
      @resource = resource
      @client = client
    end

    def resource
      @resource
    end

    def resource=(resource)
      @resource = resource
    end

    def list(args = {})
      http.get "/#{client.account}/#{resource}", args
    end

    def show(id)
      http.get "/#{client.account}/#{resource}/#{id}"
    end

    def create(args = {})
      http.post "/#{client.account}/#{resource}", { event: args }
    end

    def update(id, args = {})
      http.patch "/#{client.account}/#{resource}/#{id}", { event: args }
    end

    def destroy(id)
      http.delete "/#{client.account}/#{resource}/#{id}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
remetric-1.0.0 lib/remetric/endpoints/rest.rb