Class: ActionMailboxAmazonIngress::RSpec::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/action_mailbox_amazon_ingress/rspec/email.rb

Instance Method Summary collapse

Constructor Details

#initialize(authentic: true, topic: 'topic:arn:default', mail: default_mail, message_params: {}) ⇒ Email

Returns a new instance of Email.



6
7
8
9
10
11
# File 'lib/action_mailbox_amazon_ingress/rspec/email.rb', line 6

def initialize(authentic: true, topic: 'topic:arn:default', mail: default_mail, message_params: {})
  @authentic = authentic
  @topic = topic
  @mail = mail
  @message_params = message_params
end

Instance Method Details

#authentic?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/action_mailbox_amazon_ingress/rspec/email.rb', line 36

def authentic?
  @authentic
end

#default_mailObject



40
41
42
# File 'lib/action_mailbox_amazon_ingress/rspec/email.rb', line 40

def default_mail
  Mail.new
end

#headersObject



13
14
15
# File 'lib/action_mailbox_amazon_ingress/rspec/email.rb', line 13

def headers
  { 'content-type' => 'application/json' }
end

#message_jsonObject



29
30
31
32
33
34
# File 'lib/action_mailbox_amazon_ingress/rspec/email.rb', line 29

def message_json
  {
    'notificationType' => 'Received',
    'content' => @mail.encoded
  }.merge(@message_params).to_json
end

#paramsObject



21
22
23
24
25
26
27
# File 'lib/action_mailbox_amazon_ingress/rspec/email.rb', line 21

def params
  {
    'Type' => 'Notification',
    'TopicArn' => @topic,
    'Message' => message_json
  }
end

#urlObject



17
18
19
# File 'lib/action_mailbox_amazon_ingress/rspec/email.rb', line 17

def url
  '/rails/action_mailbox/amazon/inbound_emails'
end