Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  fix issue with Emailable::Batch#complete?. change the method for Emailable::BatchStatus#complete? to check the message string. fix the batch complete? test.
  • Loading branch information
danarnold committed Jan 17, 2022
2 parents 57b9746 + 0d14a2c commit 70112e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/emailable/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,20 @@ def verify(simulate: nil)
@id = response.body['id']
end

def status(simulate: nil)
def status(simulate: nil, partial: nil)
return nil unless @id
return @status if @status

response = @client.request(:get, 'batch', { id: @id, simulate: simulate })
body = { id: @id, simulate: simulate, partial: partial }
response = @client.request(:get, 'batch', body)
bs = BatchStatus.new(response.body)
@status = bs if bs.complete?

bs
end

def complete?
!status.complete?
status.complete?
end

def inspect
Expand Down
2 changes: 1 addition & 1 deletion lib/emailable/resources/batch_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class BatchStatus < APIResource
:processed, :total

def complete?
!emails.nil?
message.include?('completed')
end
end
end
3 changes: 1 addition & 2 deletions test/emailable/batch_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def test_batch_status
end

def test_batch_complete
complete = @batch.complete?
assert complete == true || complete == false
assert @batch.complete?
end

end
Expand Down

0 comments on commit 70112e9

Please sign in to comment.