Class: Slimekit::Timekit

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/slimekit.rb

Overview

Example usage: timekit = Timekit.new(TK_ADMIN_USER, TK_ADMIN_TOKEN) tk_user = timekit.create_user(account) someInternalUser.update(tk_token: tk_user.token)

Instance Method Summary collapse

Constructor Details

#initialize(user, password) ⇒ Timekit

Returns a new instance of Timekit.



19
20
21
# File 'lib/slimekit.rb', line 19

def initialize(user, password)
  @auth = {username: user, password: password}
end

Instance Method Details

#create_calendar(account) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/slimekit.rb', line 36

def create_calendar()
  options = {
    body: {
      name: "Appointments",
      description: "Hold bookings for clients."
    }.to_json,
    basic_auth: @auth
  }
  self.class.post('/v2/calendars', options)
end

#create_user(account) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/slimekit.rb', line 23

def create_user()
  options = {
    body: {
      "email" => .email,
      "first_name" => .first_name,
      "last_name" => .last_name,
      "timezone" => "America/Los_Angeles"
    }.to_json,
    basic_auth: @auth,
  }
  self.class.post('/v2/users/', options)
end