Class: Mailkube::Pagination

Inherits:
Object
  • Object
show all
Defined in:
lib/mailkube/types/scheduled_emails.rb,
sig/mailkube/types/scheduled_emails.rbs

Overview

The pagination block that accompanies every listing.

Every member has a default because the server adds total_count and current_page conditionally, exactly as it does the step links.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(steps: PageSteps.new, total_count: 0, current_page: 1) ⇒ Pagination

Returns a new instance of Pagination.

Parameters:

  • steps (PageSteps) (defaults to: PageSteps.new)

    links to the adjacent pages.

  • total_count (Integer) (defaults to: 0)

    matching records across every page.

  • current_page (Integer) (defaults to: 1)

    the 1-based number of the page in hand.

  • steps: (PageSteps) (defaults to: PageSteps.new)
  • total_count: (Integer) (defaults to: 0)
  • current_page: (Integer) (defaults to: 1)


66
# File 'lib/mailkube/types/scheduled_emails.rb', line 66

def initialize(steps: PageSteps.new, total_count: 0, current_page: 1) = super

Instance Attribute Details

#current_pageInteger (readonly)

Returns the value of attribute current_page.

Returns:

  • (Integer)


39
40
41
# File 'sig/mailkube/types/scheduled_emails.rbs', line 39

def current_page
  @current_page
end

#stepsPageSteps (readonly)

Returns the value of attribute steps.

Returns:



37
38
39
# File 'sig/mailkube/types/scheduled_emails.rbs', line 37

def steps
  @steps
end

#total_countInteger (readonly)

Returns the value of attribute total_count.

Returns:

  • (Integer)


38
39
40
# File 'sig/mailkube/types/scheduled_emails.rbs', line 38

def total_count
  @total_count
end

Class Method Details

.from(payload) ⇒ Pagination

Returns the model.

Parameters:

  • payload (Hash{String => Object}, nil)

    the decoded pagination block.

  • (Hash[String, untyped], nil)

Returns:



70
71
72
73
74
# File 'lib/mailkube/types/scheduled_emails.rb', line 70

def self.from(payload)
  block = payload || {}
  new(steps: PageSteps.from(block["steps"]), total_count: block["total_count"] || 0,
      current_page: block["current_page"] || 1)
end