Skip to content
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

Add support for YO! and SMS Central channels #31

Merged
merged 9 commits into from
Aug 15, 2017
Merged

Conversation

norkans7
Copy link
Contributor

@norkans7 norkans7 commented Aug 9, 2017

No description provided.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 77.654% when pulling e263e31 on yo-handlers into 21c6026 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 77.692% when pulling f1d2cf3 on yo-handlers into 21c6026 on master.

@norkans7 norkans7 changed the title Add support for YO! channels Add support for YO! and SMS Central channels Aug 10, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 76.488% when pulling 475ec55 on yo-handlers into 21c6026 on master.

Copy link
Collaborator

@nicpottier nicpottier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, just a few tweaks!

// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddReceiveMsgRoute(h, "POST", "receive", h.ReceiveMessage)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be checking error status and returning them if non-nil

func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddReceiveMsgRoute(h, "POST", "receive", h.ReceiveMessage)
s.AddReceiveMsgRoute(h, "GET", "receive", h.ReceiveMessage)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's figure out which SMS Central uses and only support that one.

func (h *handler) SendMsg(msg courier.Msg) (courier.MsgStatus, error) {
username := msg.Channel().StringConfigForKey(courier.ConfigUsername, "")
if username == "" {
return nil, fmt.Errorf("no username set for KN channel")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wrong error msg.

return status, err
}

if rr.StatusCode != 200 && rr.StatusCode != 201 && rr.StatusCode != 202 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rr.StatusCode / 100 != 2?

// Initialize is called by the engine once everything is loaded
func (h *handler) Initialize(s courier.Server) error {
h.SetServer(s)
s.AddReceiveMsgRoute(h, "POST", "receive", h.ReceiveMessage)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check error status, lets only register what these guys currently use. (look at our logs to figure out)

failed = true
}

if failed == false && rr.StatusCode != 200 && rr.StatusCode != 201 {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!failed

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe see if you can refactor this a bit with continues instead of checking failed everywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By using continue we won't be able to stop blacklisted contacts

@@ -1,6 +1,119 @@
package smscentral
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add tests for smscentral.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the file

@coveralls
Copy link

Coverage Status

Coverage increased (+0.9%) to 77.969% when pulling 82b1a92 on yo-handlers into 21c6026 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 77.528% when pulling bc4a016 on yo-handlers into 21c6026 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 77.528% when pulling 6442182 on yo-handlers into 21c6026 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 77.561% when pulling 6fc0499 on yo-handlers into 21c6026 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 77.04% when pulling 17f9b77 on yo-handlers into 21c6026 on master.

@norkans7
Copy link
Contributor Author

I have updated to only add handler for the requests we get for each channel type

@coveralls
Copy link

Coverage Status

Coverage increased (+0.6%) to 77.652% when pulling 065ed29 on yo-handlers into 21c6026 on master.

@nicpottier nicpottier merged commit bc8b042 into master Aug 15, 2017
@nicpottier nicpottier deleted the yo-handlers branch August 15, 2017 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants