Class: Seam::Pagination

Inherits:
Struct
  • Object
show all
Defined in:
lib/seam/paginator.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#has_next_pageObject

Returns the value of attribute has_next_page

Returns:

  • (Object)

    the current value of has_next_page



74
75
76
# File 'lib/seam/paginator.rb', line 74

def has_next_page
  @has_next_page
end

#next_page_cursorObject

Returns the value of attribute next_page_cursor

Returns:

  • (Object)

    the current value of next_page_cursor



74
75
76
# File 'lib/seam/paginator.rb', line 74

def next_page_cursor
  @next_page_cursor
end

#next_page_urlObject

Returns the value of attribute next_page_url

Returns:

  • (Object)

    the current value of next_page_url



74
75
76
# File 'lib/seam/paginator.rb', line 74

def next_page_url
  @next_page_url
end

Class Method Details

.from_hash(hash) ⇒ Object



75
76
77
78
79
80
81
82
83
# File 'lib/seam/paginator.rb', line 75

def self.from_hash(hash)
  return nil unless hash.is_a?(Hash) && !hash.empty?

  new(
    has_next_page: hash.fetch("has_next_page", false),
    next_page_cursor: hash.fetch("next_page_cursor", nil),
    next_page_url: hash.fetch("next_page_url", nil)
  )
end

Instance Method Details

#has_next_page?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/seam/paginator.rb', line 85

def has_next_page?
  has_next_page == true
end