Skip to content

Commit

Permalink
Add rubocop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jm-mailosaur committed Oct 27, 2021
1 parent f520088 commit 47636b3
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Metrics/BlockLength:
# Offense count: 1
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 300
Max: 500

# Offense count: 7
# Configuration parameters: CountComments, ExcludedMethods.
Expand Down
18 changes: 9 additions & 9 deletions lib/Mailosaur/messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ def search(server, criteria, page: nil, items_per_page: nil, timeout: nil, recei

#
# Create a message.
#
#
# Creates a new message that can be sent to a verified email address. This is
# useful in scenarios where you want an email to trigger a workflow in your
# product
#
# @param server [String] The identifier of the server to create the message in.
# @param options [MessageCreateOptions] The options with which to create the message.
#
#
# @return [Message] operation result.
#
def create(server, options)
def create(server, message_create_options)
response = conn.post 'api/messages?server=' + server, message_create_options.to_json
@handle_http_error.call(response) unless response.status == 200
model = JSON.load(response.body)
Expand All @@ -192,16 +192,16 @@ def create(server, options)

#
# Forward an email.
#
#
# Forwards the specified email to a verified email address.
#
# @param id [String] The identifier of the email to forward.
# @param options [MessageForwardOptions] The options with which to forward the email.
# against.
#
#
# @return [Message] operation result.
#
def forward(id, options)
def forward(id, message_forward_options)
response = conn.post 'api/messages/' + id + '/forward', message_forward_options.to_json
@handle_http_error.call(response) unless response.status == 200
model = JSON.load(response.body)
Expand All @@ -210,17 +210,17 @@ def forward(id, options)

#
# Reply to an email.
#
#
# Sends a reply to the specified email. This is useful for when simulating a user
# replying to one of your emails.
#
# @param id [String] The identifier of the email to reply to.
# @param options [MessageReplyOptions] The options with which to reply to the email.
# against.
#
#
# @return [Message] operation result.
#
def reply(id, options)
def reply(id, message_reply_options)
response = conn.post 'api/messages/' + id + '/reply', message_reply_options.to_json
@handle_http_error.call(response) unless response.status == 200
model = JSON.load(response.body)
Expand Down
2 changes: 1 addition & 1 deletion lib/Mailosaur/models/message_forward_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def initialize(data = {})
@html = data['html']
end

# @return [String] The email address to which the email will be sent.
# @return [String] The email address to which the email will be sent.
# Must be a verified email address.
attr_accessor :to

Expand Down
16 changes: 8 additions & 8 deletions test/emails_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,48 +249,48 @@ def startup
context 'forward' do
should 'forward with text content' do
target_email = @@emails[0]
body = "Forwarded message"
body = 'Forwarded message'
options = Mailosaur::Models::MessageForwardOptions.new()
options.to = 'anything@%s' % [@@verified_domain]
options.text = body
message = @@client.messages.forward(target_email.id, options)
assert_not_nil(message.id)
assert_true(message.text.body.include? body)
assert_true(message.text.body.include?(body))
end

should 'forward with HTML content' do
target_email = @@emails[0]
body = "<p>Forwarded <strong>HTML</strong> message.</p>"
body = '<p>Forwarded <strong>HTML</strong> message.</p>'
options = Mailosaur::Models::MessageForwardOptions.new()
options.to = 'anything@%s' % [@@verified_domain]
options.html = body
message = @@client.messages.forward(target_email.id, options)
assert_not_nil(message.id)
assert_true(message.html.body.include? body)
assert_true(message.html.body.include?(body))
end
end

context 'reply' do
should 'reply with text content' do
target_email = @@emails[0]
body = "Reply message"
body = 'Reply message'
options = Mailosaur::Models::MessageForwardOptions.new()
options.to = 'anything@%s' % [@@verified_domain]
options.text = body
message = @@client.messages.reply(target_email.id, options)
assert_not_nil(message.id)
assert_true(message.text.body.include? body)
assert_true(message.text.body.include?(body))
end

should 'reply with HTML content' do
target_email = @@emails[0]
body = "<p>Reply <strong>HTML</strong> message.</p>"
body = '<p>Reply <strong>HTML</strong> message.</p>'
options = Mailosaur::Models::MessageForwardOptions.new()
options.to = 'anything@%s' % [@@verified_domain]
options.html = body
message = @@client.messages.reply(target_email.id, options)
assert_not_nil(message.id)
assert_true(message.html.body.include? body)
assert_true(message.html.body.include?(body))
end
end

Expand Down

0 comments on commit 47636b3

Please sign in to comment.