Skip to content

Fix message status datetime not showing in MessageBird::Recipient object #81

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/messagebird/recipient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
module MessageBird
class Recipient < MessageBird::Base
attr_accessor :recipient, :status
attr_reader :status_date_time
attr_reader :status_datetime

def status_date_time=(value)
@status_date_time = value_to_time(value)
def status_datetime=(value)
@status_datetime = value_to_time(value)
end
end
end
2 changes: 2 additions & 0 deletions spec/message_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
.and_return('{"body": "Hello World","createdDatetime": "2015-01-05T10:02:59+00:00","datacoding": "plain","direction": "mt","gateway": 239,"href": "https://rest.messagebird.com/messages/message-id","id": "message-id","mclass": 1,"originator": "TestName","recipients": {"items": [{"recipient": 31612345678,"status": "sent","statusDatetime": "2015-01-05T10:02:59+00:00"}],"totalCount": 1,"totalDeliveredCount": 0,"totalDeliveryFailedCount": 0,"totalSentCount": 1},"reference": null,"scheduled_date_time": null,"type": "sms","typeDetails": {},"validity": null}')

message = client.message('message-id')
recipients = message.recipients['items']

expect(message.id).to eq 'message-id'
expect(recipients.first.status_datetime.to_s).to eq '2015-01-05 10:02:59 +0000'
end

it 'creates' do
Expand Down