Class: Timekit::Calendar::Client

Inherits:
Timekit::Client show all
Defined in:
lib/timekit/calendar/client.rb

Overview

Client class for the calendar resource

Constant Summary collapse

API_PATH =
'/calendars'

Instance Method Summary collapse

Methods inherited from Timekit::Client

#initialize

Constructor Details

This class inherits a constructor from Timekit::Client

Instance Method Details

#create(name, description, background_color = nil, foreground_color = nil) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/timekit/calendar/client.rb', line 9

def create(
  name,
  description,
  background_color = nil,
  foreground_color = nil
)
  params = {
    name: name,
    description: description
  }

  params[:backgroundcolor] = background_color if background_color
  params[:foregroundcolor] = foreground_color if foreground_color

  post(API_PATH, params)
end

#delete(id) ⇒ Object



34
35
36
# File 'lib/timekit/calendar/client.rb', line 34

def delete(id)
  super(API_PATH + '/' + id.to_s)
end

#listObject



26
27
28
# File 'lib/timekit/calendar/client.rb', line 26

def list
  get(API_PATH)
end

#show(id) ⇒ Object



30
31
32
# File 'lib/timekit/calendar/client.rb', line 30

def show(id)
  get(API_PATH + '/' + id.to_s)
end