Class: Msgraph::Api::Resource::List
- Inherits:
-
Base
- Object
- Base
- Msgraph::Api::Resource::List
show all
- Defined in:
- lib/msgraph/api/resource/list.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#attributes, #parent, #resource_name
Instance Method Summary
collapse
Methods inherited from Base
#client, lists, #method_missing, resource_name, #user
Constructor Details
#initialize(parent, clazz, resource_name) ⇒ List
8
9
10
11
|
# File 'lib/msgraph/api/resource/list.rb', line 8
def initialize(parent, clazz, resource_name)
super(parent, resource_name: resource_name)
@child_class = clazz
end
|
Instance Attribute Details
#child_class ⇒ Object
Returns the value of attribute child_class.
6
7
8
|
# File 'lib/msgraph/api/resource/list.rb', line 6
def child_class
@child_class
end
|
Instance Method Details
#each ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/msgraph/api/resource/list.rb', line 21
def each
next_link = first_link
while !next_link.nil?
next_link = page_for(next_link) do |elements|
elements.each{|e| yield e}
end
end
end
|
#empty? ⇒ Boolean
39
40
41
|
# File 'lib/msgraph/api/resource/list.rb', line 39
def empty?
size == 0
end
|
#find(id) ⇒ Object
17
18
19
|
# File 'lib/msgraph/api/resource/list.rb', line 17
def find(id)
child_class.new(self, resource_name: resource_name, id: id)
end
|
#resource_path ⇒ Object
13
14
15
|
# File 'lib/msgraph/api/resource/list.rb', line 13
def resource_path
parent.resource_path
end
|
#size ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/msgraph/api/resource/list.rb', line 30
def size
if @size.nil?
page_for(first_link) do |_, size|
@size ||= size
end
end
@size
end
|