Class: Nylas::Scheduler

Inherits:
Object
  • Object
show all
Includes:
Model
Defined in:
lib/nylas/scheduler.rb

Overview

Ruby representation of a the Nylas Scheduler API

Instance Attribute Summary

Attributes included from Model

#api

Instance Method Summary collapse

Methods included from Model

#auth_method, #create, #destroy, #execute, included, #model_class, #persisted?, #reload, #resource_path, #resources_path, #save, #save_all_attributes, #to_json, #update, #update_all_attributes

Instance Method Details

#get_available_calendarsObject

Raises:

  • (ArgumentError)


24
25
26
27
28
29
30
31
# File 'lib/nylas/scheduler.rb', line 24

def get_available_calendars
  raise ArgumentError, "Cannot get calendars for a page without an ID." if id.nil?

  api.execute(
    method: :get,
    path: "/manage/pages/#{id}/calendars"
  )
end

#upload_image(content_type:, object_name:) ⇒ Object

Raises:

  • (ArgumentError)


33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/nylas/scheduler.rb', line 33

def upload_image(content_type:, object_name:)
  raise ArgumentError, "Cannot upload an image to a page without an ID." if id.nil?

  payload = {
    contentType: content_type,
    objectName: object_name
  }
  api.execute(
    method: :put,
    path: "/manage/pages/#{id}/upload-image",
    payload: JSON.dump(payload)
  )
end