Improve documentation

Daniel O'Connor 10 gadi atpakaļ
vecāks
revīzija
fc3b67e7d0
1 mainītis faili ar 33 papildinājumiem un 2 dzēšanām
  1. 33 2
      app/models/agents/google_calendar_publish_agent.rb

+ 33 - 2
app/models/agents/google_calendar_publish_agent.rb

@@ -7,7 +7,33 @@ module Agents
7 7
     description <<-MD
8 8
       The GoogleCalendarPublishAgent creates events on your google calendar.
9 9
 
10
+      This agent relies on service accounts, rather than oauth.
10 11
 
12
+      Setup:
13
+
14
+      1) Visit https://code.google.com/apis/console/b/0/
15
+
16
+      2) New project -> Huginn
17
+ 
18
+      3) APIs & Auth -> Enable google calendar
19
+
20
+      4) Credentials -> Create new Client ID -> Service Account
21
+
22
+      5) Persist the generated private key to a path, ie: /home/hugin/a822ccdefac89fac6330f95039c492dfa3ce6843.p12
23
+
24
+      6) Grant access via google calendar UI to the service account email address for each calendar you wish to manage. For a whole google apps domain, you can delegate authority (https://developers.google.com/+/domains/authentication/delegation)
25
+
26
+
27
+      Agent Configuration:
28
+
29
+      `calendar_id` - The id the calendar you want to publish to. Typically your google account email address.
30
+
31
+      `service_account_email` - The authorised service account.
32
+
33
+      `key_file` - The path to the key file.
34
+
35
+      `key_secret` - The secret for the key, typically 'notasecret'
36
+      
11 37
 
12 38
       Set `expected_update_period_in_days` to the maximum amount of time that you'd expect to pass between Events being created by this Agent.
13 39
     MD
@@ -23,8 +49,13 @@ module Agents
23 49
     def default_options
24 50
       {
25 51
         'expected_update_period_in_days' => "10",
26
-        'calendar_id' => '?',
27
-        'message' => "{{text}}"
52
+        'calendar_id' => 'you@email.com',
53
+        'message' => "{{text}}",
54
+        'google' => {
55
+          'key_file' => '/path/to/private.key'
56
+          'key_secret' => 'notasecret',
57
+          'service_account_email' => ''
58
+        }
28 59
       }
29 60
     end
30 61