Skip to content

Commit

Permalink
Allow sender ID
Browse files Browse the repository at this point in the history
  • Loading branch information
kirs committed Nov 1, 2013
1 parent 0abdb68 commit 0b527c2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.markdown
Expand Up @@ -20,5 +20,5 @@ Sending sms:

~~~~ ruby
sms = Smsc::Sms.new('login', 'password', 'windows-1251') # encoding is optional - utf-8 by default
sms.message('Some nice message', ['+11111234567', '+12221234567'])
~~~~~
sms.message('Some nice message', ['+11111234567', '+12221234567'], sender: "custom sender id") # sender is optional
~~~~~
13 changes: 11 additions & 2 deletions lib/smsc.rb
Expand Up @@ -15,8 +15,17 @@ def initialize(login, password, charset = 'utf-8')
end
end

def message(message, phones)
@connection.post '/sys/send.php', { login: @login, psw: @password, phones: phones.join(','), mes: message, charset: @charset }
def message(message, phones, options = {})
params = {
login: @login,
psw: @password,
phones: phones.join(','),
mes: message,
charset: @charset,
sender: options[:sender]
}

@connection.post '/sys/send.php', params
end

end
Expand Down

0 comments on commit 0b527c2

Please sign in to comment.