Class: Alman::CalendarsEndpoint

Inherits:
ApiEndpoint show all
Defined in:
lib/alman/endpoints/calendars_endpoint.rb

Instance Attribute Summary

Attributes inherited from ApiEndpoint

#client, #parent

Instance Method Summary collapse

Methods inherited from ApiEndpoint

#initialize

Constructor Details

This class inherits a constructor from Alman::ApiEndpoint

Instance Method Details

#all(params = {}, headers = {}) ⇒ Object



8
9
10
11
12
# File 'lib/alman/endpoints/calendars_endpoint.rb', line 8

def all(params={}, headers={})
  method = ApiMethod.new(:get, "/calendars", params, headers, @parent)
  json = @client.execute(method)
  ApiList.new(:Calendar, json, method)
end

#create(params = {}, headers = {}) ⇒ Object



41
42
43
44
45
# File 'lib/alman/endpoints/calendars_endpoint.rb', line 41

def create(params={}, headers={})
  method = ApiMethod.new(:post, "/calendars", params, headers, @parent)
  json = @client.execute(method)
  Calendar.new(json, method)
end

#delete(calendar_id, params = {}, headers = {}) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/alman/endpoints/calendars_endpoint.rb', line 23

def delete(calendar_id, params={}, headers={})
  params = ParamsBuilder.merge({
    :calendar_id => calendar_id,
  }, params)
  method = ApiMethod.new(:delete, "/calendars/:calendar_id", params, headers, @parent)
  json = @client.execute(method)
  Calendar.new(json, method)
end

#new(id) ⇒ Object



4
5
6
# File 'lib/alman/endpoints/calendars_endpoint.rb', line 4

def new(id)
  Calendar.new({:id => id}, nil, @client)
end

#retrieve(calendar_id, params = {}, headers = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/alman/endpoints/calendars_endpoint.rb', line 14

def retrieve(calendar_id, params={}, headers={})
  params = ParamsBuilder.merge({
    :calendar_id => calendar_id,
  }, params)
  method = ApiMethod.new(:get, "/calendars/:calendar_id", params, headers, @parent)
  json = @client.execute(method)
  Calendar.new(json, method)
end

#update(calendar_id, params = {}, headers = {}) ⇒ Object



32
33
34
35
36
37
38
39
# File 'lib/alman/endpoints/calendars_endpoint.rb', line 32

def update(calendar_id, params={}, headers={})
  params = ParamsBuilder.merge({
    :calendar_id => calendar_id,
  }, params)
  method = ApiMethod.new(:put, "/calendars/:calendar_id", params, headers, @parent)
  json = @client.execute(method)
  Calendar.new(json, method)
end