Class: Caly::Providers::MicrosoftGraph

Inherits:
Base
  • Object
show all
Defined in:
lib/caly/providers/microsoft_graph.rb

Instance Method Summary collapse

Constructor Details

#initialize(token) ⇒ MicrosoftGraph

Returns a new instance of MicrosoftGraph.



4
5
6
7
# File 'lib/caly/providers/microsoft_graph.rb', line 4

def initialize(token)
  @url = "https://graph.microsoft.com/v1.0/me"
  super
end

Instance Method Details

#list_calendarsObject



9
10
11
12
13
14
15
16
17
# File 'lib/caly/providers/microsoft_graph.rb', line 9

def list_calendars
  response = execute_request(:get, "calendars")

  return error_from(response) unless response["code"] == "200"

  response["value"].map do |c|
    Caly::Calendar.new(id: c["id"], name: c["name"], raw: c) if c["canEdit"] == true
  end.compact
end