Class: Calendlyr::Collection
- Inherits:
-
Object
- Object
- Calendlyr::Collection
- Defined in:
- lib/calendlyr/collection.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#next_page ⇒ Object
readonly
Returns the value of attribute next_page.
-
#next_page_token ⇒ Object
readonly
Returns the value of attribute next_page_token.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data:, count:, next_page:, client:) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(data:, count:, next_page:, client:) ⇒ Collection
Returns a new instance of Collection.
17 18 19 20 21 22 23 |
# File 'lib/calendlyr/collection.rb', line 17 def initialize(data:, count:, next_page:, client:) @data = data @count = count @next_page = next_page @next_page_token = get_params(next_page)["page_token"]&.first @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/calendlyr/collection.rb', line 6 def client @client end |
#count ⇒ Object (readonly)
Returns the value of attribute count.
6 7 8 |
# File 'lib/calendlyr/collection.rb', line 6 def count @count end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/calendlyr/collection.rb', line 6 def data @data end |
#next_page ⇒ Object (readonly)
Returns the value of attribute next_page.
6 7 8 |
# File 'lib/calendlyr/collection.rb', line 6 def next_page @next_page end |
#next_page_token ⇒ Object (readonly)
Returns the value of attribute next_page_token.
6 7 8 |
# File 'lib/calendlyr/collection.rb', line 6 def next_page_token @next_page_token end |
Class Method Details
.from_response(response, type:, client:) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/calendlyr/collection.rb', line 8 def self.from_response(response, type:, client:) new( data: response["collection"].map { |attrs| type.new(attrs.merge(client: client)) }, count: response.dig("pagination", "count"), next_page: response.dig("pagination", "next_page"), client: client ) end |