Class: Rerout::Models::ListLinksResult

Inherits:
Object
  • Object
show all
Defined in:
lib/rerout/models.rb

Overview

Paginated list of links.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(links:, next_cursor:) ⇒ ListLinksResult

Returns a new instance of ListLinksResult.



215
216
217
218
219
# File 'lib/rerout/models.rb', line 215

def initialize(links:, next_cursor:)
  @links = links.freeze
  @next_cursor = next_cursor
  freeze
end

Instance Attribute Details

Returns the value of attribute links.



213
214
215
# File 'lib/rerout/models.rb', line 213

def links
  @links
end

#next_cursorObject (readonly)

Returns the value of attribute next_cursor.



213
214
215
# File 'lib/rerout/models.rb', line 213

def next_cursor
  @next_cursor
end

Class Method Details

.from_hash(hash) ⇒ Object



221
222
223
224
225
226
# File 'lib/rerout/models.rb', line 221

def self.from_hash(hash)
  new(
    links: (hash['links'] || []).map { |l| Link.from_hash(l) },
    next_cursor: hash['next_cursor']
  )
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



232
233
234
# File 'lib/rerout/models.rb', line 232

def ==(other)
  other.is_a?(ListLinksResult) && other.to_h == to_h
end

#hashObject



237
238
239
# File 'lib/rerout/models.rb', line 237

def hash
  to_h.hash
end

#to_hObject



228
229
230
# File 'lib/rerout/models.rb', line 228

def to_h
  { links: links.map(&:to_h), next_cursor: next_cursor }
end