Class: Remetric::RESTEndpoint
- Defined in:
- lib/remetric/endpoints/rest.rb
Instance Method Summary collapse
- #create(args = {}) ⇒ Object
- #destroy(id) ⇒ Object
-
#initialize(resource, client) ⇒ RESTEndpoint
constructor
A new instance of RESTEndpoint.
- #list(args = {}) ⇒ Object
- #resource ⇒ Object
- #resource=(resource) ⇒ Object
- #show(id) ⇒ Object
- #update(id, args = {}) ⇒ Object
Methods inherited from Endpoint
Constructor Details
#initialize(resource, client) ⇒ RESTEndpoint
Returns a new instance of RESTEndpoint.
3 4 5 6 |
# File 'lib/remetric/endpoints/rest.rb', line 3 def initialize(resource, client) @resource = resource @client = client end |
Instance Method Details
#create(args = {}) ⇒ Object
24 25 26 |
# File 'lib/remetric/endpoints/rest.rb', line 24 def create(args = {}) http.post "/#{client.account}/#{resource}", { event: args } end |
#destroy(id) ⇒ Object
32 33 34 |
# File 'lib/remetric/endpoints/rest.rb', line 32 def destroy(id) http.delete "/#{client.account}/#{resource}/#{id}" end |
#list(args = {}) ⇒ Object
16 17 18 |
# File 'lib/remetric/endpoints/rest.rb', line 16 def list(args = {}) http.get "/#{client.account}/#{resource}", args end |
#resource ⇒ Object
8 9 10 |
# File 'lib/remetric/endpoints/rest.rb', line 8 def resource @resource end |
#resource=(resource) ⇒ Object
12 13 14 |
# File 'lib/remetric/endpoints/rest.rb', line 12 def resource=(resource) @resource = resource end |
#show(id) ⇒ Object
20 21 22 |
# File 'lib/remetric/endpoints/rest.rb', line 20 def show(id) http.get "/#{client.account}/#{resource}/#{id}" end |
#update(id, args = {}) ⇒ Object
28 29 30 |
# File 'lib/remetric/endpoints/rest.rb', line 28 def update(id, args = {}) http.patch "/#{client.account}/#{resource}/#{id}", { event: args } end |