Class: NgrokAPI::Models::Listable
- Inherits:
-
Object
- Object
- NgrokAPI::Models::Listable
- Defined in:
- lib/ngrokapi/models/listable.rb
Overview
A resource representing multiple instances from a given “list” API call
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#iter ⇒ Object
readonly
Returns the value of attribute iter.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#list_property ⇒ Object
readonly
Returns the value of attribute list_property.
-
#next_page_uri ⇒ Object
readonly
Returns the value of attribute next_page_uri.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(client:, result:, list_property:, klass:) ⇒ Listable
constructor
A new instance of Listable.
- #to_s ⇒ Object
Constructor Details
#initialize(client:, result:, list_property:, klass:) ⇒ Listable
Returns a new instance of Listable.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ngrokapi/models/listable.rb', line 17 def initialize(client:, result:, list_property:, klass:) @client = client @result = result @list_property = list_property @next_page_uri = @result['next_page_uri'] @uri = @result['uri'] @items = @result[list_property].map do |item| klass.new(client: client, result: item) end @iter = NgrokAPI::PagedIterator.new( client: client, page: self, list_property: list_property ) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
8 9 10 |
# File 'lib/ngrokapi/models/listable.rb', line 8 def client @client end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
8 9 10 |
# File 'lib/ngrokapi/models/listable.rb', line 8 def items @items end |
#iter ⇒ Object (readonly)
Returns the value of attribute iter.
8 9 10 |
# File 'lib/ngrokapi/models/listable.rb', line 8 def iter @iter end |
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
8 9 10 |
# File 'lib/ngrokapi/models/listable.rb', line 8 def klass @klass end |
#list_property ⇒ Object (readonly)
Returns the value of attribute list_property.
8 9 10 |
# File 'lib/ngrokapi/models/listable.rb', line 8 def list_property @list_property end |
#next_page_uri ⇒ Object (readonly)
Returns the value of attribute next_page_uri.
8 9 10 |
# File 'lib/ngrokapi/models/listable.rb', line 8 def next_page_uri @next_page_uri end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/ngrokapi/models/listable.rb', line 8 def result @result end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
8 9 10 |
# File 'lib/ngrokapi/models/listable.rb', line 8 def uri @uri end |
Instance Method Details
#==(other) ⇒ Object
33 34 35 |
# File 'lib/ngrokapi/models/listable.rb', line 33 def ==(other) @result == other.result end |
#to_s ⇒ Object
37 38 39 |
# File 'lib/ngrokapi/models/listable.rb', line 37 def to_s @result.to_s end |