Class: Timekit::Widget::Client

Inherits:
Client
  • Object
show all
Defined in:
lib/timekit/widget/client.rb

Overview

Client class for the widget resource

Constant Summary collapse

API_PATH =
'/widgets'

Instance Method Summary collapse

Methods inherited from Client

#initialize

Constructor Details

This class inherits a constructor from Timekit::Client

Instance Method Details

#create(config, name, slug) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/timekit/widget/client.rb', line 37

def create(
  config,
  name,
  slug
)
  params = {
    config: config,
    name: name,
    slug: slug
  }

  post(API_PATH, params)
end

#delete(id) ⇒ Object



51
52
53
# File 'lib/timekit/widget/client.rb', line 51

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

#embed(id) ⇒ Object



13
14
15
# File 'lib/timekit/widget/client.rb', line 13

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

#hosted(slug) ⇒ Object



17
18
19
# File 'lib/timekit/widget/client.rb', line 17

def hosted(slug)
  get(API_PATH + '/hosted/' + slug)
end

#listObject



9
10
11
# File 'lib/timekit/widget/client.rb', line 9

def list
  get(API_PATH)
end

#update(id, config, name = nil, slug = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/timekit/widget/client.rb', line 21

def update(
  id,
  config,
  name = nil,
  slug = nil
)
  params = {
    config: config
  }

  params[:name] = name if name
  params[:slug] = slug if slug

  put(API_PATH + '/' + id.to_s, params)
end