5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/teamsnap/structure.rb', line 5
def init(client, collection)
classes = []
schema = collection
.fetch(:links) { [] }
.find { |link| link[:rel] == "schemas" } || {}
if schema[:href]
resp = client.get(schema[:href].gsub("/v3",""))
classes = setup_model_classes(collection, resp)
else
client.in_parallel do
classes = collection
.fetch(:links) { [] }
.map { |link| classify_rel(client, link) }
end
end
classes.compact
classes.each{ |cls| cls.parse_collection }
true
end
|