nileshtrivedi-gupshup 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +17 -3
- data/lib/gupshup.rb +14 -1
- metadata +6 -7
data/README.rdoc
CHANGED
@@ -14,22 +14,36 @@ http://enterprise.smsgupshup.com/doc/GatewayAPIDoc.doc
|
|
14
14
|
|
15
15
|
== FEATURES:
|
16
16
|
|
17
|
+
* V 0.1.2 Bulk file upload implemented. Only CSV format supported for now.
|
17
18
|
* V 0.1.0 send_vcard and send_unicode_message implemented. Error checking.
|
18
19
|
* V 0.0.5 send_text_message and send_flash_message are implemented
|
19
20
|
* V 0.0.1 send_message is implemented.
|
20
21
|
|
21
22
|
== USAGE:
|
22
23
|
|
24
|
+
# "target_phone_number" should be a 12 digit Indian mobile number starting with "919" (either integer or string)
|
25
|
+
|
23
26
|
gup = Gupshup::Enterprise.new('your_gupshup_login','password')
|
27
|
+
|
28
|
+
#send a normal text message
|
24
29
|
gup.send_text_message('sms message text',target_phone_number)
|
30
|
+
|
31
|
+
#flash messages appear on mobile's screen immediately but may not be saved on some handsets
|
25
32
|
gup.send_flash_message('sms message text',target_phone_number)
|
33
|
+
|
34
|
+
#send a contact in VCARD format
|
35
|
+
vcard = "BEGIN:VCARD\r\nVERSION:1.2\r\nN:ICICI\r\nTEL:18002098888\r\nEND:VCARD"
|
26
36
|
gup.send_vcard(vcard,target_phone_number)
|
27
|
-
gup.send_unicode_message(unicode_message_in_utf8_encoding,target_phone_number)
|
28
37
|
|
29
|
-
|
38
|
+
#send a non-english message with a hex-encoded UTF-8 string
|
39
|
+
gup.send_unicode_message("\xE0\xA4\x97\xE0\xA4\xAA\xE0\xA4\xB6\xE0\xA4\xAA",target_phone_number) # will send "gupshup" in Devnagari script
|
40
|
+
|
41
|
+
#Upload a CSV file for bulk messages
|
42
|
+
gup.bulk_file_upload(file_path)
|
43
|
+
|
30
44
|
== REQUIREMENTS:
|
31
45
|
|
32
|
-
*
|
46
|
+
* httpclient
|
33
47
|
|
34
48
|
== INSTALL:
|
35
49
|
|
data/lib/gupshup.rb
CHANGED
@@ -4,9 +4,10 @@ $:.unshift(File.dirname(__FILE__)) unless
|
|
4
4
|
require 'net/http'
|
5
5
|
require 'uri'
|
6
6
|
require 'cgi'
|
7
|
+
require 'httpclient'
|
7
8
|
|
8
9
|
module Gupshup
|
9
|
-
VERSION = '0.1.
|
10
|
+
VERSION = '0.1.2'
|
10
11
|
class Enterprise
|
11
12
|
def initialize(login,password)
|
12
13
|
@api_url = 'http://enterprise.smsgupshup.com/GatewayAPI/rest'
|
@@ -66,5 +67,17 @@ module Gupshup
|
|
66
67
|
def send_unicode_message(msg,number,opts = {})
|
67
68
|
send_message(msg,number,:UNICODE_TEXT,opts)
|
68
69
|
end
|
70
|
+
|
71
|
+
def bulk_file_upload(file_path,file_type = 'csv',mime_type = 'text/csv', opts = {})
|
72
|
+
msg_params = {}
|
73
|
+
msg_params[:method] = 'xlsUpload'
|
74
|
+
msg_params[:filetype] = file_type.to_s
|
75
|
+
file = File.new(file_path,"r")
|
76
|
+
def file.mime_type; "text/csv"; end
|
77
|
+
msg_params[:xlsFile] = file
|
78
|
+
resp = HTTPClient.post(@api_url,msg_params.merge(@api_params).merge(opts))
|
79
|
+
file.close
|
80
|
+
puts resp.body.content
|
81
|
+
end
|
69
82
|
end
|
70
83
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nileshtrivedi-gupshup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nilesh Trivedi
|
@@ -9,18 +9,18 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-09-05 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
type: :
|
16
|
+
name: httpclient
|
17
|
+
type: :runtime
|
18
18
|
version_requirement:
|
19
19
|
version_requirements: !ruby/object:Gem::Requirement
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.
|
23
|
+
version: 2.1.5.2
|
24
24
|
version:
|
25
25
|
description: Ruby wrapper for SMSGupShup API
|
26
26
|
email:
|
@@ -47,7 +47,6 @@ files:
|
|
47
47
|
- test/test_helper.rb
|
48
48
|
has_rdoc: false
|
49
49
|
homepage: http://github.com/nileshtrivedi/gupshup
|
50
|
-
licenses:
|
51
50
|
post_install_message: PostInstall.txt
|
52
51
|
rdoc_options:
|
53
52
|
- --main
|
@@ -69,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
68
|
requirements: []
|
70
69
|
|
71
70
|
rubyforge_project: gupshup
|
72
|
-
rubygems_version: 1.
|
71
|
+
rubygems_version: 1.2.0
|
73
72
|
signing_key:
|
74
73
|
specification_version: 3
|
75
74
|
summary: Ruby wrapper for SMSGupShup API
|