Class: MetaSms::Smsbox
- Inherits:
-
ISmsProvider
- Object
- ISmsProvider
- MetaSms::Smsbox
- Defined in:
- lib/meta_sms/providers/smsbox.rb
Overview
This is a sms provider class which inherits ISmsProvider.
Constant Summary collapse
- SMSBOX_PUBLIC_API_URI =
"http://smsbox.in/SecureApi.aspx?"
- REQ_CONFIG_PARAMS =
Smsbox required config params = smsbox_user_name, smsbox_key, route, from Smsbox optional config params = type, logging
[:smsbox_user_name, :smsbox_key, :route, :from]
Constants inherited from ISmsProvider
ISmsProvider::REQUIRED_OPTIONS
Instance Method Summary collapse
-
#api_url ⇒ String
This method will make an api url.
- #parsed_uri ⇒ Object
-
#send_sms ⇒ Type
Description of method.
Methods inherited from ISmsProvider
#check_for_valid_mobile_number, #check_required_option, #initialize
Constructor Details
This class inherits a constructor from MetaSms::ISmsProvider
Instance Method Details
#api_url ⇒ String
This method will make an api url
40 41 42 |
# File 'lib/meta_sms/providers/smsbox.rb', line 40 def api_url "#{SMSBOX_PUBLIC_API_URI}usr=#{smsbox_user_name}&key=#{smsbox_key}&smstype=#{MetaSms.config.type}&to=#{mobile_number}&msg=#{}&rout=#{route}&from=#{from}" end |
#parsed_uri ⇒ Object
32 33 34 |
# File 'lib/meta_sms/providers/smsbox.rb', line 32 def parsed_uri URI.parse(URI.encode(api_url.strip)) end |
#send_sms ⇒ Type
Description of method
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/meta_sms/providers/smsbox.rb', line 21 def send_sms res = Net::HTTP.get parsed_uri case res when "Error : Authentication Failed. Please Try Again" ProviderUtility.authentication_error when "Error : Your balance is low for sending message." ProviderUtility.raise_low_balance_exception end res end |