-
Notifications
You must be signed in to change notification settings - Fork 1
Add pair_sms #9
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
base: master
Are you sure you want to change the base?
Add pair_sms #9
Conversation
|
Looks good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include an options hash for extensibility? I believe it would look something like this:
def pair_sms(phone_number, user_name, phone_country='', options={})
parameters = {
'phone_number' => phone_number,
'user_name' => user_name
}
phone_country.empty? or (parameters['phone_country'] = phone_country)
parameters.merge(options)
return PairingStatus.new(post('pairings/create/sms', parameters))
endThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that, but we should use **options instead of options = {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would need to be either
parameters.merge!(options)
return PairingStatus.new(post('pairings/create/sms', parameters))or
return PairingStatus.new(post('pairings/create/sms', parameters.merge(options))There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruby doesn't have **kwargs -- the equivalent for Ruby 1.9 is the options hash ((Ruby 2.0 added better support for keyword args)[http://robots.thoughtbot.com/ruby-2-keyword-arguments]). We've also used the options hash in the pair method above pair_sms.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 to options for consistency with pair. Please use merge instead of merge!.
|
|
Tidying up the language library. Matching functionality of toopher-python library.