Class: QualtricsAPI::BaseCollection
Instance Attribute Summary
Attributes included from Connectable
#connection
Instance Method Summary
collapse
#propagate_connection
#as_json, #to_json
Instance Method Details
#each ⇒ Object
9
10
11
12
13
14
15
|
# File 'lib/qualtrics_api/base_collection.rb', line 9
def each
each_page do |page|
page.each do |element|
yield element
end
end
end
|
#each_page ⇒ Object
17
18
19
20
21
22
23
24
25
|
# File 'lib/qualtrics_api/base_collection.rb', line 17
def each_page
endpoint = list_endpoint
loop do
response = QualtricsAPI.connection(self).get(endpoint)
endpoint = response.body["result"]["nextPage"]
yield parse_page(response)
break unless endpoint
end
end
|
#find(id) ⇒ Object
27
28
29
30
31
|
# File 'lib/qualtrics_api/base_collection.rb', line 27
def find(id)
response = QualtricsAPI.connection(self).get(endpoint(id))
return nil unless response.status == 200
build_result(response.body['result']).propagate_connection(self)
end
|