Update docs slightly

Daniel O'Connor 10 jaren geleden
bovenliggende
commit
e28b63e3e3
1 gewijzigde bestanden met toevoegingen van 32 en 23 verwijderingen
  1. 32 23
      app/models/agents/google_calendar_publish_agent.rb

+ 32 - 23
app/models/agents/google_calendar_publish_agent.rb

@@ -11,17 +11,12 @@ module Agents
11 11
 
12 12
       Setup:
13 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)
14
+      1. Visit [the google api console](https://code.google.com/apis/console/b/0/)
15
+      2. New project -> Huginn
16
+      3. APIs & Auth -> Enable google calendar
17
+      4. Credentials -> Create new Client ID -> Service Account
18
+      5. Persist the generated private key to a path, ie: `/home/hugin/a822ccdefac89fac6330f95039c492dfa3ce6843.p12`
19
+      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 20
 
26 21
 
27 22
       Agent Configuration:
@@ -36,12 +31,37 @@ module Agents
36 31
 
37 32
       `google` `key_secret` - The secret for the key, typically 'notasecret'
38 33
 
39
-      `details` A hash of event details. See https://developers.google.com/google-apps/calendar/v3/reference/events/insert
40 34
       
41 35
 
42 36
       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.
43 37
 
44 38
       Use it with a trigger agent to shape your payload!
39
+
40
+      A hash of event details. See the [Google Calendar API docs](https://developers.google.com/google-apps/calendar/v3/reference/events/insert)
41
+
42
+      Example payload for trigger agent:
43
+      <pre><code>{
44
+        'visibility' => 'default',
45
+        'summary' => "Awesome event",
46
+        'description' => "An example event with text. Pro tip: DateTimes are in RFC3339",
47
+        'start' => {
48
+          'dateTime' => '2014-10-02T10:00:00-05:00'
49
+        },
50
+        'end' => {
51
+          'dateTime' => '2014-10-02T11:00:00-05:00'
52
+        }
53
+      }</code></pre>
54
+    MD
55
+
56
+    event_description <<-MD
57
+      {
58
+        'success' => true,
59
+        'published_calendar_event' => {
60
+           ....
61
+        },
62
+        'agent_id' => 1234,
63
+        'event_id' => 3432,
64
+      }
45 65
     MD
46 66
 
47 67
     def validate_options
@@ -61,17 +81,6 @@ module Agents
61 81
           'key_file' => '/path/to/private.key',
62 82
           'key_secret' => 'notasecret',
63 83
           'service_account_email' => ''
64
-        },
65
-        'details' => {
66
-          'visibility' => 'default',
67
-          'summary' => "Awesome event",
68
-          'description' => "An example event with text. Pro tip: DateTimes are in RFC3339",
69
-          'start' => {
70
-            'dateTime' => '2014-10-02T10:00:00-05:00'
71
-          },
72
-          'end' => {
73
-            'dateTime' => '2014-10-02T11:00:00-05:00'
74
-          }
75 84
         }
76 85
       }
77 86
     end