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.



408
409
410
411
412
# File 'lib/rerout/models.rb', line 408

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

Instance Attribute Details

Returns the value of attribute links.



406
407
408
# File 'lib/rerout/models.rb', line 406

def links
  @links
end

#next_cursorObject (readonly)

Returns the value of attribute next_cursor.



406
407
408
# File 'lib/rerout/models.rb', line 406

def next_cursor
  @next_cursor
end

Class Method Details

.from_hash(hash) ⇒ Object



414
415
416
417
418
419
# File 'lib/rerout/models.rb', line 414

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?



425
426
427
# File 'lib/rerout/models.rb', line 425

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

#hashObject



430
431
432
# File 'lib/rerout/models.rb', line 430

def hash
  to_h.hash
end

#to_hObject



421
422
423
# File 'lib/rerout/models.rb', line 421

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