Initial support for sending SMS from short codes#26
Initial support for sending SMS from short codes#26philnash wants to merge 1 commit intovisualitypl:masterfrom
Conversation
|
👍 Looks great to me, I can't seem to point at the ref / github in my Gemfile to test locally. Trying by copying into the gem temporarily. Its early but am I missing something: gem 'textris', github: 'visualitypl/textris', ref: '48935afd28b8d7d96d202482ea334105f0104309' ? |
|
It's on my fork of the gem right now, so you want |
|
Works locally just copy/pasting into local files in the gem. 👍 |
ronin
left a comment
There was a problem hiding this comment.
Hey @philnash. Thanks for this contribution. Would you mind doing little refactoring? I think it will be better to implement Utils as a plain class instead of module that is included in different classes.
May I suggest to use name ShortCode for this class and then just use it like
ShortCode.is_short_code?(phone)
# or
ShortCode.valid?(phone)
# or
ShortCode.plausible?(phone)And tests for this class will be simpler.
|
Hey @ronin, sounds like a good idea. I'll get on that soon. |
|
Oh wow! I completely forgot about this. I'll take a look and update soon. |
|
FYI: In Norway short numbers are 4 digits. |
|
Closing this in favour of #39. |
This should fix #25.
I have included an
is_short_code?method that does a basic check on whether a number looks like a short code. In this case, that is simply whether it is a 5 or 6 digit long number. There are more restrictions on short codes than that, however this is a start and the assumption is that users would know what short code they are using along with the restrictions around it (i.e. no international messages).I've started a
Utilsclass for theis_short_code?method as it was needed in two places.Utilsis not a great name but I couldn't think of anything better right now.