-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.rb
122 lines (79 loc) · 2.3 KB
/
index.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# *******************************************
# This is a demo file to show usage.
#
# @package TheCity
# @author Wes Hays <[email protected]>
# *******************************************
require File.dirname(__FILE__) + '/lib/the_city.rb'
## Initalize
# First param is your church's subdomain key.
# Second param is whether or not to cache the data.
the_city = TheCity.new('practice', true)
# Set the group nickname to pull plaza items for.
# http://helpdesk.onthecity.org/entries/422776-group-nickname
# the_city.set_group_nickname('@v21west')
## Load Topics
array_of_topic_titles = the_city.topics.titles
# by default will grab 10 topics.
topics = the_city.topics
# Enumerable topics
topics.each { |t| t.title }
topics.collect { |t| t.title }
# limit the amount of topics fetched from The City.
topics = the_city.topics(3)
# Get topic.
topic = topics.select(2)
# Get count.
topic = topics.size
## Load Events
array_of_event_titles = the_city.events.titles
# by default will grab 10 events.
events = the_city.events
# Enumerable events
events.each { |e| e.title }
events.collect { |e| e.title }
# limit the amount of events fetched from The City
events = the_city.events(3)
# Get event.
event = events.select(2)
# Get count.
event = events.size
## Load Prayers
array_of_prayer_titles = the_city.prayers.titles
# by default will grab 10 prayers.
prayers = the_city.prayers
# Enumerable events
prayers.each { |p| p.title }
prayers.collect { |p| p.title }
# limit the amount of prayers fetched from The City
prayers = the_city.prayers(3)
# Get prayer.
prayer = prayers.select(2)
# Get count.
prayer = prayers.size
## Load Needs
array_of_need_titles = the_city.prayers.titles
# by default will grab 10 needs.
needs = the_city.needs
# Enumerable events
needs.each { |n| n.title }
needs.collect { |n| n.title }
# limit the amount of needs fetched from The City
needs = the_city.needs(3)
# Get need.
need = needs.select(2)
# Get count.
need = needs.size
## Albums
array_of_album_titles = the_city.albums.titles
# by default will grab 10 albums.
albums = the_city.albums
# Enumerable events
albums.each { |a| a.title }
albums.collect { |a| a.title }
# limit the amount of albums fetched from The City
albums = the_city.albums(3)
# Get album.
album = albums.select(2)
# Get count.
album = albums.size