Class: Sendgrid::API::Newsletter::Schedule::Services

Inherits:
Service
  • Object
show all
Includes:
Utils
Defined in:
lib/sendgrid/api/newsletter/schedule.rb

Instance Attribute Summary

Attributes inherited from Service

#resource

Instance Method Summary collapse

Methods inherited from Service

#initialize, #perform_request

Constructor Details

This class inherits a constructor from Sendgrid::API::Service

Instance Method Details

#add(marketing_email, options = {}) ⇒ Entities::Response

Schedule a delivery time for an existing Marketing Email.

Parameters:

  • marketing_email (String, Entities::MarketingEmail)

    A marketing email name or Entities::MarketingEmail object.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :at (String)

    Date/Time to schedule marketing email Delivery. Date/Time must be provided in ISO 8601 format (YYYY-MM-DD HH:MM:SS+-HH:MM)

  • :after (Fixnum)

    Number of minutes until delivery should occur. Must be a positive integer.

Returns:

See Also:



26
27
28
29
30
31
32
# File 'lib/sendgrid/api/newsletter/schedule.rb', line 26

def add(marketing_email, options = {})
  options.keep_if {|key, value| [:at, :after].include?(key) }
  options[:at] = format_time(options[:at]) if options.member?(:at)
  params = { :name => extract_marketing_email(marketing_email) }
  params.merge!(options) if options.any?
  perform_request(Entities::Response, 'newsletter/schedule/add.json', params)
end

#delete(marketing_email) ⇒ Entities::Response

Cancel a scheduled send for a Marketing Email.

Parameters:

Returns:

See Also:



49
50
51
52
# File 'lib/sendgrid/api/newsletter/schedule.rb', line 49

def delete(marketing_email)
  params = { :name => extract_marketing_email(marketing_email) }
  perform_request(Entities::Response, 'newsletter/schedule/delete.json', params)
end

#get(marketing_email) ⇒ Entities::Schedule

Retrieve the scheduled delivery time for an existing Marketing Email.

Parameters:

Returns:

See Also:



39
40
41
42
# File 'lib/sendgrid/api/newsletter/schedule.rb', line 39

def get(marketing_email)
  params = { :name => extract_marketing_email(marketing_email) }
  perform_request(Entities::Schedule, 'newsletter/schedule/get.json', params)
end