Class: Mailkube::ScheduledEmailPage

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

Overview

One page of scheduled emails: the records, plus how to reach the neighbouring pages.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pagination: Pagination.new, data: []) ⇒ ScheduledEmailPage

Returns a new instance of ScheduledEmailPage.

Parameters:

  • pagination (Pagination) (defaults to: Pagination.new)

    page metadata, including the adjacent-page links.

  • data (Array<ScheduledEmail>) (defaults to: [])

    the scheduled emails on this page.

  • pagination: (Pagination) (defaults to: Pagination.new)
  • data: (Array[ScheduledEmail]) (defaults to: [])


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

def initialize(pagination: Pagination.new, data: []) = super

Instance Attribute Details

#dataArray[ScheduledEmail] (readonly)

Returns the value of attribute data.

Returns:



47
48
49
# File 'sig/mailkube/types/scheduled_emails.rbs', line 47

def data
  @data
end

#paginationPagination (readonly)

Returns the value of attribute pagination.

Returns:



46
47
48
# File 'sig/mailkube/types/scheduled_emails.rbs', line 46

def pagination
  @pagination
end

Class Method Details

.from(payload) ⇒ ScheduledEmailPage

Returns the model.

Parameters:

  • payload (Hash{String => Object})

    the decoded listing body.

  • (Hash[String, untyped])

Returns:



85
86
87
88
# File 'lib/mailkube/types/scheduled_emails.rb', line 85

def self.from(payload)
  new(pagination: Pagination.from(payload["pagination"]),
      data: (payload["data"] || []).map { |item| ScheduledEmail.from(item) })
end

Instance Method Details

#more?Boolean

Spelled more? rather than has_more: Ruby's predicate convention, and the same call this gem already makes for Email#scheduled? where the other SDKs say is_scheduled.

Returns:

  • (Boolean)

    true when the server issued a link to a following page.



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

def more? = !pagination.steps.next.nil?