Class: EmailDirect::RelaySend::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/emaildirect/relay_send/email.rb

Overview

Represents a relay send custom email

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(category_id) ⇒ Email

Returns a new instance of Email.

Raises:

  • (ArgumentError)


9
10
11
12
# File 'lib/emaildirect/relay_send/email.rb', line 9

def initialize(category_id)
  @category_id = category_id
  raise ArgumentError, 'Category ID is required' unless @category_id
end

Instance Attribute Details

#category_idObject (readonly)

Returns the value of attribute category_id.



7
8
9
# File 'lib/emaildirect/relay_send/email.rb', line 7

def category_id
  @category_id
end

Instance Method Details

#send(options) ⇒ Object

Sends a custom message. See the docs for all the possible options



16
17
18
19
# File 'lib/emaildirect/relay_send/email.rb', line 16

def send(options)
  response = EmailDirect.post "/RelaySends/#{category_id}", :body => options.to_json
  Hashie::Mash.new(response)
end