Module: Mobilyws
- Defined in:
- lib/mobilyws.rb,
lib/mobilyws/api.rb,
lib/mobilyws/version.rb
Defined Under Namespace
Constant Summary collapse
- SEND_MSG_RESPONSES =
{ "1" => "SMS sent successfully", "2" => APIError.new("Your balance is 0"), "3" => APIError.new("Your balance is not enough"), "4" => APIError.new("Invalid mobile number (or invalid username)"), "5" => APIError.new("Invalid password."), "6" => APIError.new("SMS-API not responding, please try again"), "7" => APIError.new("Sender name is not accepted"), "8" => APIError.new("Sender name is not active from Mobily.ws and mobile telecommunications companies"), "9" => APIError.new("Mobile(s) number(s) is not specified or incorrect"), "13" => APIError.new("Sender name is unaccepted"), "14" => APIError.new("Sender name is unkonwn"), "15" => APIError.new("received numbers are invalid or empty"), "16" => APIError.new("Sender name is empty"), "17" => APIError.new("Message text is not specified or not encoded properly with Mobily.ws Unicode"), "18" => APIError.new("Sending SMS stopped from support"), "19" => APIError.new("ApplicationType is not specified or invalid"), }
- UTF8_CHAR_ENCODE =
I stole this nice hash from github.com/moh-alsheikh/mobilywscli
{ "،" => "060D" , "؛"=> "061B", "؟"=> "061F", "ء"=> "0621", "آ"=> "0622", "أ"=> "0623", "ؤ"=> "0624", "إ"=> "0625", "ئ"=> "0626", "ا"=> "0627", "ب"=> "0628", "ة"=> "0629", "ت"=> "062A", "ث"=> "062B", "ج"=> "062C", "ح"=> "062D", "خ"=> "062E", "د"=> "062F", "ذ" => "0630", "ر"=> "0631", "ز"=> "0632", "س"=> "0633", "ش"=> "0634", "ص"=> "0635", "ض"=> "0636", "ط"=> "0637", "ظ"=> "0638", "ع"=> "0639", "غ"=> "063A", "ف"=> "0641", "ق"=> "0642", "ك"=> "0643", "ل"=> "0644", "م"=> "0645", "ن"=> "0646", "ه"=> "0647", "و"=> "0648", "ى"=> "0649", "ي"=> "064A", "ـ" => "0640", "ً" => "064B", "ٌ"=> "064C", "ٍ"=> "064D", "َ"=> "064E", "ُ"=> "064F", "ِ"=> "0650", "ّ"=> "0651", "ْ"=> "0652", "!"=> "0021", '""'=> "0022", "#"=> "0023", "$"=> "0024", "%"=> "0025", "&"=> "0026", "'"=> "0027", "("=> "0028", ")"=> "0029", "*"=> "002A", "+"=> "002B", ","=> "002C", "-"=> "002D", "."=> "002E", "/"=> "002F", "0"=> "0030", "1"=> "0031", "2"=> "0032", "3"=> "0033", "4"=> "0034", "5"=> "0035", "6"=> "0036", "7"=> "0037", "8"=> "0038", "9"=> "0039", ":"=> "003A", ""=> "003B", "<"=> "003C", "="=> "003D", ">"=> "003E", "?"=> "003F", "@"=> "0040", "A"=> "0041", "B"=> "0042", "C"=> "0043", "D"=> "0044", "E"=> "0045", "F"=> "0046", "G"=> "0047", "H"=> "0048", "I"=> "0049", "J"=> "004A", "K"=> "004B", "L"=> "004C", "M"=> "004D", "N"=> "004E", "O"=> "004F", "P"=> "0050", "Q"=> "0051", "R"=> "0052", "S"=> "0053", "T"=> "0054", "U"=> "0055", "V"=> "0056", "W"=> "0057", "X"=> "0058", "Y"=> "0059", "Z"=> "005A", '[" "('=> "005B", "\\"=> "005C", ']" ")'=> "005D", "^"=> "005E", "_"=> "005F", "`"=> "0060", "a"=> "0061", "b"=> "0062", "c"=> "0063", "d"=> "0064", "e"=> "0065", "f"=> "0066", "g"=> "0067", "h"=> "0068", "i"=> "0069", "j"=> "006A", "k"=> "006B", "l"=> "006C", "m"=> "006D", "n"=> "006E", "o"=> "006F", "p"=> "0070", "q"=> "0071", "r"=> "0072", "s"=> "0073", "t"=> "0074", "u"=> "0075", "v"=> "0076", "w"=> "0077", "x"=> "0078", "y"=> "0079", "z"=> "007A", "{"=> "007B", "|"=> "007C", "}"=> "007D", "~"=> "007E", "©"=> "00A9", "®"=> "00AE", "÷"=> "00F7", "×"=> "00F7", "§"=> "00A7", "\r"=> "000A", " " => "0020" }
- VERSION =
"0.2.0"
Class Method Summary collapse
-
.encode(message) ⇒ Object
TODO Freeze keys and values.
Class Method Details
.encode(message) ⇒ Object
TODO Freeze keys and values
182 183 184 185 186 |
# File 'lib/mobilyws.rb', line 182 def self.encode() = "" .each_char {|c| << UTF8_CHAR_ENCODE.fetch(c, c) } end |