Sha256: 888d9c7ff610c710290028542f81cc3dd65376df593b263e338c0679ba9fe770
Contents?: true
Size: 1.9 KB
Versions: 1
Compression:
Stored size: 1.9 KB
Contents
require "smsgh_sms/version" require 'cgi' require 'curb-fu' module SmsghSms @@api_username = nil @@api_password = nil @@api_client_id = nil @@api_client_secret = nil @@api_senderid = "SMSGHAPI" # Expects :msg, :to and an optional :from param # The :from param defaults to @@api_senderid when its omitted def self.push(options={}) sender_id = options[:from].nil? ? @@api_senderid : options[:from] response = nil raise ArgumentError, ':msg and :to params expected' if options[:msg].nil? || options[:to].nil? if @@api_username != nil && @@api_password != nil response = CurbFu.get({:host => 'api.smsgh.com', :path => '/v2/messages/send'}, { :from => sender_id, :to => options[:to], :text => options[:msg], :username => @@api_username, :password => @@api_password }) end if @@api_client_id != nil && @@api_client_secret != nil response = CurbFu.get({:host => 'api.smsgh.com', :path => '/v3/messages/send', :protocol => 'https'}, { :From => sender_id, :To => options[:to], :Content => options[:msg], :ClientId => @@api_client_id, :ClientSecret => @@api_client_secret }) end {:status => response.status, :notice => response.body} end def self.api_username=(api_username); @@api_username = api_username; end def self.api_username; @@api_username; end def self.api_password=(api_password); @@api_password = api_password; end def self.api_password; @@api_password; end def self.api_client_id=(api_client_id); @@api_client_id = api_client_id; end def self.api_client_id; @@api_client_id; end def self.api_client_secret=(api_client_secret); @@api_client_secret = api_client_secret; end def self.api_password; @@api_client_secret; end def self.api_senderid=(api_senderid); @@api_senderid = api_senderid; end def self.api_senderid; @@api_senderid; end endd); @@api_senderid = api_senderid; end def self.api_senderid; @@api_senderid; end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
smsgh_sms-1.0.3 | lib/smsgh_sms.rb |