lib/kotsms2.rb in kotsms2-1.0.1 vs lib/kotsms2.rb in kotsms2-1.1.0
- old
+ new
@@ -11,10 +11,11 @@
def initialize(options={})
@user_agent = options.fetch(:agent) { "kotsms2/#{VERSION}" }
@api_host = options.fetch(:host) { 'api.kotsms.com.tw' }
@username = options.fetch(:username) { ENV.fetch('KOTSMS_USERNAME') }
@password = options.fetch(:password) { ENV.fetch('KOTSMS_PASSWORD') }
+ @timeout = options.fetch(:timeout) { 10 }
end
def account_is_available
balance_info = get_balance
balance_info[:message_quota] > 0 && balance_info[:access_success]
@@ -39,7 +40,16 @@
def get_balance
response = get(@api_host, '/memberpoint.php')
format_balance_info(response)
end
+
+ def get_message_status(options={})
+ options[:message_id] ||= nil
+
+ response = get(@api_host, '/msgstatus.php', kmsgid: options[:message_id])
+
+ format_message_status(response)
+ end
+
end
end