Class: Exa::Resources::WebsetCollection

Inherits:
Struct
  • Object
show all
Defined in:
lib/exa/resources/webset_collection.rb

Overview

Represents a paginated list of websets from the Exa API

This class wraps the JSON response from the GET /websets/v0/websets endpoint and provides pagination support.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data:, has_more: false, next_cursor: nil) ⇒ WebsetCollection

Returns a new instance of WebsetCollection.



15
16
17
18
# File 'lib/exa/resources/webset_collection.rb', line 15

def initialize(data:, has_more: false, next_cursor: nil)
  super
  freeze
end

Instance Attribute Details

#dataObject

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



9
10
11
# File 'lib/exa/resources/webset_collection.rb', line 9

def data
  @data
end

#has_moreObject

Returns the value of attribute has_more

Returns:

  • (Object)

    the current value of has_more



9
10
11
# File 'lib/exa/resources/webset_collection.rb', line 9

def has_more
  @has_more
end

#next_cursorObject

Returns the value of attribute next_cursor

Returns:

  • (Object)

    the current value of next_cursor



9
10
11
# File 'lib/exa/resources/webset_collection.rb', line 9

def next_cursor
  @next_cursor
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/exa/resources/webset_collection.rb', line 20

def empty?
  data.empty?
end

#to_hObject



24
25
26
27
28
29
30
# File 'lib/exa/resources/webset_collection.rb', line 24

def to_h
  {
    data: data,
    has_more: has_more,
    next_cursor: next_cursor
  }
end