rubeetup 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,634 @@
1
+ {
2
+ "get_open_events": {
3
+ "path": "->(options) { \"/2/open_events\" }",
4
+ "options": [
5
+ "category",
6
+ "city",
7
+ "country",
8
+ "lat",
9
+ "lon",
10
+ "state",
11
+ "text",
12
+ "topic",
13
+ "zip"
14
+ ]
15
+ },
16
+ "get_concierge": {
17
+ "path": "->(options) { \"/2/concierge\" }",
18
+ "options": [
19
+
20
+ ]
21
+ },
22
+ "get_events": {
23
+ "path": "->(options) { \"/2/events\" }",
24
+ "options": [
25
+ "event_id",
26
+ "group_domain",
27
+ "group_id",
28
+ "group_urlname",
29
+ "member_id",
30
+ "rsvp",
31
+ "venue_id"
32
+ ]
33
+ },
34
+ "create_event": {
35
+ "path": "->(_) { \"/2/event\" }",
36
+ "options": [
37
+ [
38
+ "group_id",
39
+ "group_urlname",
40
+ "name"
41
+ ]
42
+ ]
43
+ },
44
+ "get_event": {
45
+ "path": "->(options) { \"/2/event/#{options[:id]}\" }",
46
+ "options": [
47
+ "id"
48
+ ]
49
+ },
50
+ "edit_event": {
51
+ "path": "->(options) { \"/2/event/#{options[:id]}\" }",
52
+ "options": [
53
+ "id"
54
+ ]
55
+ },
56
+ "delete_event": {
57
+ "path": "->(options) { \"/2/event/#{options[:id]}\" }",
58
+ "options": [
59
+ "id"
60
+ ]
61
+ },
62
+ "get_event_comments": {
63
+ "path": "->(options) { \"/2/event_comments\" }",
64
+ "options": [
65
+ "comment_id",
66
+ "event_id",
67
+ "group_id",
68
+ "member_id"
69
+ ]
70
+ },
71
+ "create_event_comment": {
72
+ "path": "->(_) { \"/2/event_comment\" }",
73
+ "options": [
74
+ [
75
+ "comment",
76
+ "event_id"
77
+ ],
78
+ [
79
+ "in_reply_to",
80
+ "event_id"
81
+ ]
82
+ ]
83
+ },
84
+ "get_event_comment": {
85
+ "path": "->(options) { \"/2/event_comment/#{options[:id]}\" }",
86
+ "options": [
87
+ "id"
88
+ ]
89
+ },
90
+ "delete_event_comment": {
91
+ "path": "->(options) { \"/2/event_comment/#{options[:id]}\" }",
92
+ "options": [
93
+ "id"
94
+ ]
95
+ },
96
+ "create_event_comment_flag": {
97
+ "path": "->(_) { \"/2/event_comment_flag\" }",
98
+ "options": [
99
+ "comment_id"
100
+ ]
101
+ },
102
+ "create_event_comment_subscribe": {
103
+ "path": "->(options) { \"/2/event_comment_subscribe/#{options[:comment_id]}\" }",
104
+ "options": [
105
+ "comment_id"
106
+ ]
107
+ },
108
+ "delete_event_comment_subscribe": {
109
+ "path": "->(options) { \"/2/event_comment_subscribe/#{options[:comment_id]}\" }",
110
+ "options": [
111
+ "comment_id"
112
+ ]
113
+ },
114
+ "create_event_comment_like": {
115
+ "path": "->(options) { \"/2/event_comment_like/#{options[:comment_id]}\" }",
116
+ "options": [
117
+ "comment_id"
118
+ ]
119
+ },
120
+ "delete_event_comment_like": {
121
+ "path": "->(options) { \"/2/event_comment_like/#{options[:comment_id]}\" }",
122
+ "options": [
123
+ "comment_id"
124
+ ]
125
+ },
126
+ "get_event_comment_likes": {
127
+ "path": "->(options) { \"/2/event_comment_likes\" }",
128
+ "options": [
129
+ "comment_id"
130
+ ]
131
+ },
132
+ "get_event_ratings": {
133
+ "path": "->(options) { \"/2/event_ratings\" }",
134
+ "options": [
135
+ "event_id"
136
+ ]
137
+ },
138
+ "create_event_rating": {
139
+ "path": "->(_) { \"/2/event_rating\" }",
140
+ "options": [
141
+ [
142
+ "event_id",
143
+ "rating"
144
+ ]
145
+ ]
146
+ },
147
+ "create_attendance": {
148
+ "path": "->(options) { \"/#{options[:urlname]}/events/#{options[:event_id]}/attendance\" }",
149
+ "options": [
150
+ [
151
+ "event_id",
152
+ "urlname",
153
+ "member",
154
+ "status"
155
+ ]
156
+
157
+ ]
158
+ },
159
+ "get_attendance": {
160
+ "path": "->(options) { \"/#{options[:urlname]}/events/#{options[:event_id]}/attendance\" }",
161
+ "options": [
162
+ [
163
+ "event_id",
164
+ "urlname"
165
+ ]
166
+ ]
167
+ },
168
+ "create_event_payments": {
169
+ "path": "->(options) { \"/#{options[:urlname]}/events/#{options[:event_id]}/payments\" }",
170
+ "options": [
171
+ [
172
+ "event_id",
173
+ "urlname",
174
+ "member",
175
+ "amount"
176
+ ]
177
+ ]
178
+ },
179
+ "create_watchlist": {
180
+ "path": "->(options) { \"/#{options[:urlname]}/events/#{options[:event_id]}/watchlist\" }",
181
+ "options": [
182
+ [
183
+ "event_id",
184
+ "urlname"
185
+ ]
186
+ ]
187
+ },
188
+ "delete_watchlist": {
189
+ "path": "->(options) { \"/#{options[:urlname]}/events/#{options[:event_id]}/watchlist\" }",
190
+ "options": [
191
+ [
192
+ "event_id",
193
+ "urlname"
194
+ ]
195
+ ]
196
+ },
197
+ "get_boards": {
198
+ "path": "->(options) { \"/#{options[:urlname]}/boards\" }",
199
+ "options": [
200
+ "urlname"
201
+ ]
202
+ },
203
+ "get_discussions": {
204
+ "path": "->(options) { \"/#{options[:urlname]}/boards/#{options[:board_id]}/discussions\" }",
205
+ "options": [
206
+ [
207
+ "urlname",
208
+ "board_id"
209
+ ]
210
+ ]
211
+ },
212
+ "get_discussion_posts": {
213
+ "path": "->(options) { \"/#{options[:urlname]}/boards/#{options[:board_id]}/discussions/#{options[:discussion_id]}\" }",
214
+ "options": [
215
+ [
216
+ "urlname",
217
+ "board_id",
218
+ "discussion_id"
219
+ ]
220
+ ]
221
+ },
222
+ "get_categories": {
223
+ "path": "->(options) { \"/2/categories\" }",
224
+ "options": [
225
+
226
+ ]
227
+ },
228
+ "get_cities": {
229
+ "path": "->(options) { \"/2/cities\" }",
230
+ "options": [
231
+
232
+ ]
233
+ },
234
+ "get_dashboard": {
235
+ "path": "->(options) { \"/dashboard\" }",
236
+ "options": [
237
+
238
+ ]
239
+ },
240
+ "get_activity": {
241
+ "path": "->(options) { \"/activity\" }",
242
+ "options": [
243
+
244
+ ]
245
+ },
246
+ "get_groups": {
247
+ "path": "->(options) { \"/2/groups\" }",
248
+ "options": [
249
+ "category_id",
250
+ [
251
+ "country",
252
+ "city",
253
+ "state"
254
+ ],
255
+ "domain",
256
+ "group_id",
257
+ "group_urlname",
258
+ [
259
+ "lat",
260
+ "lon"
261
+ ],
262
+ "member_id",
263
+ "organizer_id",
264
+ "topic",
265
+ [
266
+ "topic",
267
+ "groupnum"
268
+ ],
269
+ "zip"
270
+ ]
271
+ },
272
+ "get_comments": {
273
+ "path": "->(options) { \"/comments\" }",
274
+ "options": [
275
+ "group_id",
276
+ "group_urlname",
277
+ [
278
+ "topic",
279
+ "groupnum"
280
+ ]
281
+ ]
282
+ },
283
+ "create_group_photo": {
284
+ "path": "->(_) { \"/2/group_photo\" }",
285
+ "options": [
286
+ [
287
+ "group_id",
288
+ "photo"
289
+ ],
290
+ [
291
+ "group_urlname",
292
+ "photo"
293
+ ]
294
+ ],
295
+ "multipart": "->(options) { options[:photo] = UploadIO.new(options[:photo], 'application/octet-stream') }"
296
+ },
297
+ "get_find_groups": {
298
+ "path": "->(options) { \"/find/groups\" }",
299
+ "options": [
300
+
301
+ ]
302
+ },
303
+ "get_group": {
304
+ "path": "->(options) { \"/#{options[:group_urlname]}\" }",
305
+ "options": [
306
+ "group_urlname"
307
+ ]
308
+ },
309
+ "edit_group": {
310
+ "path": "->(options) { \"/#{options[:group_urlname]}\" }",
311
+ "options": [
312
+ "group_urlname"
313
+ ]
314
+ },
315
+ "create_group_topics": {
316
+ "path": "->(options) { \"/#{options[:group_urlname]}/topics\" }",
317
+ "options": [
318
+ [
319
+ "group_urlname",
320
+ "topic_id"
321
+ ]
322
+ ]
323
+ },
324
+ "delete_group_topics": {
325
+ "path": "->(options) { \"/#{options[:group_urlname]}/topics\" }",
326
+ "options": [
327
+ [
328
+ "group_urlname",
329
+ "topic_id"
330
+ ]
331
+ ]
332
+ },
333
+ "get_recommended_groups": {
334
+ "path": "->(options) { \"/recommended/groups\" }",
335
+ "options": [
336
+
337
+ ]
338
+ },
339
+ "create_recommended_groups_ignores": {
340
+ "path": "->(options) { \"/recommended/groups/ignores/#{options[:group_urlname]}\" }",
341
+ "options": [
342
+ "group_urlname"
343
+ ]
344
+ },
345
+ "get_similar_groups": {
346
+ "path": "->(options) { \"/#{options[:urlname]}/similar_groups\" }",
347
+ "options": [
348
+ "urlname"
349
+ ]
350
+ },
351
+ "get_members": {
352
+ "path": "->(options) { \"/2/members\" }",
353
+ "options": [
354
+ "group_id",
355
+ "group_urlname",
356
+ "member_id",
357
+ "service",
358
+ [
359
+ "topic",
360
+ "groupnum"
361
+ ]
362
+ ]
363
+ },
364
+ "get_member": {
365
+ "path": "->(options) { \"/2/member/#{options[:id]}\" }",
366
+ "options": [
367
+ "id"
368
+ ]
369
+ },
370
+ "edit_member": {
371
+ "path": "->(options) { \"/2/member/#{options[:id]}\" }",
372
+ "options": [
373
+ "id"
374
+ ]
375
+ },
376
+ "delete_member_photo": {
377
+ "path": "->(options) { \"/2/member_photo/#{options[:id]}\" }",
378
+ "options": [
379
+ "id"
380
+ ]
381
+ },
382
+ "create_member_photo": {
383
+ "path": "->(_) { \"/2/member_photo\" }",
384
+ "options": [
385
+ "photo"
386
+ ],
387
+ "multipart": "->(options) { options[:photo] = UploadIO.new(options[:photo], 'application/octet-stream') }"
388
+ },
389
+ "get_status": {
390
+ "path": "->(_) { \"/status\" }",
391
+ "options": [
392
+
393
+ ]
394
+ },
395
+ "get_notifications": {
396
+ "path": "->(options) { \"/notifications\" }",
397
+ "options": [
398
+
399
+ ]
400
+ },
401
+ "create_notifications_read": {
402
+ "path": "->(_) { \"/notifications/read\" }",
403
+ "options": [
404
+ "since_id"
405
+ ]
406
+ },
407
+ "get_oembed": {
408
+ "path": "->(options) { \"/oembed\" }",
409
+ "options": [
410
+ "url"
411
+ ]
412
+ },
413
+ "delete_photo": {
414
+ "path": "->(options) { \"/2/photo/#{options[:id]}\" }",
415
+ "options": [
416
+ "id"
417
+ ]
418
+ },
419
+ "get_photo_comments": {
420
+ "path": "->(options) { \"/2/photo_comments\" }",
421
+ "options": [
422
+ "photo_id"
423
+ ]
424
+ },
425
+ "create_photo_comment": {
426
+ "path": "->(_) { \"/2/photo_comment\" }",
427
+ "options": [
428
+ [
429
+ "photo_id",
430
+ "comment"
431
+ ]
432
+ ]
433
+ },
434
+ "get_photo_albums": {
435
+ "path": "->(options) { \"/2/photo_albums\" }",
436
+ "options": [
437
+ "photo_album_id",
438
+ "event_id",
439
+ "group_id"
440
+ ]
441
+ },
442
+ "get_photos": {
443
+ "path": "->(options) { \"/2/photos\" }",
444
+ "options": [
445
+ "event_id",
446
+ "group_id",
447
+ "group_urlname",
448
+ "member_id",
449
+ "photo_album_id",
450
+ "photo_id",
451
+ "tagged"
452
+ ]
453
+ },
454
+ "create_photo_album": {
455
+ "path": "->(_) { \"/2/photo_album\" }",
456
+ "options": [
457
+ [
458
+ "group_id",
459
+ "title"
460
+ ]
461
+ ]
462
+ },
463
+ "create_photo": {
464
+ "path": "->(_) { \"/2/photo\" }",
465
+ "options": [
466
+ [
467
+ "photo",
468
+ "event_id"
469
+ ],
470
+ [
471
+ "photo",
472
+ "photo_album_id"
473
+ ]
474
+ ],
475
+ "multipart": "->(options) { options[:photo] = UploadIO.new(options[:photo], 'application/octet-stream') }"
476
+ },
477
+ "get_profiles": {
478
+ "path": "->(options) { \"/2/profiles\" }",
479
+ "options": [
480
+ "group_id",
481
+ "group_urlname",
482
+ "member_id",
483
+ [
484
+ "topic",
485
+ "groupnum"
486
+ ]
487
+ ]
488
+ },
489
+ "create_profile": {
490
+ "path": "->(_) { \"/2/profile\" }",
491
+ "options": [
492
+ "group_id",
493
+ "group_urlname"
494
+ ]
495
+ },
496
+ "edit_profile": {
497
+ "path": "->(options) { \"/2/profile/#{options[:group_id]}/#{options[:member_id]}\" }",
498
+ "options": [
499
+ [
500
+ "group_id",
501
+ "member_id"
502
+ ]
503
+ ]
504
+ },
505
+ "get_profile": {
506
+ "path": "->(options) { \"/2/profile/#{options[:group_id]}/#{options[:member_id]}\" }",
507
+ "options": [
508
+ [
509
+ "group_id",
510
+ "member_id"
511
+ ]
512
+ ]
513
+ },
514
+ "delete_profile": {
515
+ "path": "->(options) { \"/2/profile/#{options[:group_id]}/#{options[:member_id]}\" }",
516
+ "options": [
517
+ [
518
+ "group_id",
519
+ "member_id"
520
+ ]
521
+ ]
522
+ },
523
+ "create_member_approvals": {
524
+ "path": "->(options) { \"/#{options[:urlname]}/member/approvals\" }",
525
+ "options": [
526
+ "urlname"
527
+ ]
528
+ },
529
+ "delete_member_approvals": {
530
+ "path": "->(options) { \"/#{options[:urlname]}/member/approvals\" }",
531
+ "options": [
532
+ "urlname"
533
+ ]
534
+ },
535
+ "get_rsvps": {
536
+ "path": "->(options) { \"/2/rsvps\" }",
537
+ "options": [
538
+ "event_id"
539
+ ]
540
+ },
541
+ "create_rsvp": {
542
+ "path": "->(_) { \"/2/rsvp\" }",
543
+ "options": [
544
+ [
545
+ "event_id",
546
+ "rsvp"
547
+ ]
548
+ ]
549
+ },
550
+ "edit_rsvp": {
551
+ "path": "->(_) { \"/2/rsvp\" }",
552
+ "options": [
553
+ [
554
+ "event_id",
555
+ "rsvp"
556
+ ]
557
+ ]
558
+ },
559
+ "get_rsvp": {
560
+ "path": "->(options) { \"/2/rsvp/#{options[:id]}\" }",
561
+ "options": [
562
+ "id"
563
+ ]
564
+ },
565
+ "get_topic_categories": {
566
+ "path": "->(options) { \"/2/topic_categories\" }",
567
+ "options": [
568
+
569
+ ]
570
+ },
571
+ "get_topics": {
572
+ "path": "->(options) { \"/topics\" }",
573
+ "options": [
574
+ "member_id",
575
+ "name",
576
+ "search",
577
+ "topic"
578
+ ]
579
+ },
580
+ "get_recommended_group_topics": {
581
+ "path": "->(options) { \"/recommended/group_topics\" }",
582
+ "options": [
583
+ "text",
584
+ "other_topics"
585
+ ]
586
+ },
587
+ "get_open_venues": {
588
+ "path": "->(options) { \"/2/open_venues\" }",
589
+ "options": [
590
+ "country",
591
+ "city",
592
+ "state",
593
+ "group_urlname",
594
+ "lat",
595
+ "lon",
596
+ "text",
597
+ "zip"
598
+ ]
599
+ },
600
+ "get_venues": {
601
+ "path": "->(options) { \"/2/venues\" }",
602
+ "options": [
603
+ "group_id",
604
+ "group_urlname",
605
+ "venue_id",
606
+ "event_id"
607
+ ]
608
+ },
609
+ "get_group_venues": {
610
+ "path": "->(options) { \"/#{options[:urlname]}/venues\" }",
611
+ "options": [
612
+ "urlname"
613
+ ]
614
+ },
615
+ "get_recommended_venues": {
616
+ "path": "->(options) { \"/recommended/venues\" }",
617
+ "options": [
618
+
619
+ ]
620
+ },
621
+ "create_venue": {
622
+ "path": "->(options) { \"/#{options[:group_urlname]}/venues\" }",
623
+ "options": [
624
+ [
625
+ "group_urlname",
626
+ "address_1",
627
+ "country",
628
+ "city",
629
+ "state",
630
+ "name"
631
+ ]
632
+ ]
633
+ }
634
+ }
@@ -0,0 +1,33 @@
1
+ module Rubeetup
2
+ ##
3
+ # Concrete implementation of a catalog
4
+ # @note it respects the interface demanded by Rubeetup::RequestCatalog, and
5
+ # as such, it provides a module method +.requests+, and for each entry in the
6
+ # catalog there exists a Hash which can respond to +[:options]+ and +[:path]+
7
+ #
8
+ module MeetupCatalog
9
+ extend Rubeetup::Utilities
10
+ class << self
11
+ ##
12
+ # Returns a Hash including all the supported requests. Each entry in the hash
13
+ # corresponds to a request, and it specifies both its +path+, and its <tt>required options</tt>.
14
+ # @return [Hash{Symbol=>Hash{Symbol=>Lambda, Symbol=>Array<Symbol>}}]
15
+ # @note Rubeetup automatically passes authentication options with +each+ request,
16
+ # and no request can even be initiated without it.
17
+ # Even though the required options for these requests omit this auth data,
18
+ # it is implied that it is indeed required for all the following requests
19
+ # to have it.
20
+ #
21
+ def requests
22
+ # @note I've averaged times for both YAML and JSON, and JSON:
23
+ # For 200 runs: YAML => 0.00315 JSON => 0.00027
24
+ # Well that just about does it...
25
+ #YAML.load(File.read("#{catalog_dir}meetup_catalog.yaml"))
26
+
27
+ hash = JSON.parse(File.read("#{catalog_dir}meetup_catalog.json"), symbolize_names: true)
28
+ # Now transform all the required options into symbols
29
+ hash.each {|_, val| val[:options] = collection_symbolyzer(val[:options]) }
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,29 @@
1
+ module Rubeetup
2
+ ##
3
+ # Simple wrapper to allow the use of method missing in order provide fancier
4
+ # RequestResponse's attributes access.
5
+ #
6
+ class ResponseWrapper
7
+ ##
8
+ # @param [Hash{Symbol=> ...}] data hash of response data
9
+ #
10
+ def initialize(data)
11
+ @hash = data
12
+ end
13
+
14
+ ##
15
+ # It captures messages passed on this object, and only responds to messages
16
+ # for which the @hash can provide a non-nil value.
17
+ #
18
+ def method_missing(name, *args)
19
+ if name == :[]
20
+ key = args.first
21
+ @hash.include?(key) ? @hash[key] : super
22
+ elsif @hash.include? name
23
+ @hash[name]
24
+ else
25
+ super
26
+ end
27
+ end
28
+ end
29
+ end