magti 0.1.0 → 0.1.1rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +3 -3
- data/lib/magti/config.rb +1 -5
- data/lib/magti/sms.rb +2 -6
- data/lib/magti/version.rb +1 -1
- data/magti.gemspec +0 -2
- metadata +6 -23
data/README.md
CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
|
|
23
23
|
Start with configuring the gem:
|
24
24
|
|
25
25
|
```ruby
|
26
|
-
Magti.config(
|
26
|
+
Magti.config(:username => 'testuser', :password => 'secret', :service => 1, :client => 1)
|
27
27
|
```
|
28
28
|
|
29
29
|
`username`, `password`, `service` and `client` parameters are provided by Magticom itself.
|
@@ -44,7 +44,7 @@ puts resp.code # => 0000 for normal processing
|
|
44
44
|
puts resp.id # => nil unless resp.code = '0000'
|
45
45
|
```
|
46
46
|
|
47
|
-
After message is sent
|
47
|
+
After message is sent you can track it's progress by calling:
|
48
48
|
|
49
49
|
```ruby
|
50
50
|
status = Magti.track_sms(resp.id)
|
@@ -54,4 +54,4 @@ Status value `1` indicates, that the message was delivered to the mobile phone.
|
|
54
54
|
|
55
55
|
## Additional resources
|
56
56
|
|
57
|
-
Protocol description which is used by this gem, can be found in `refs` subdirectory.
|
57
|
+
Protocol description which is used by this gem, can be found in `refs` subdirectory.
|
data/lib/magti/config.rb
CHANGED
@@ -3,7 +3,7 @@ require 'singleton'
|
|
3
3
|
|
4
4
|
module Magti
|
5
5
|
# URL for sending SMS.
|
6
|
-
SMS_SEND_URL = 'http://81.95.160.47/mt/
|
6
|
+
SMS_SEND_URL = 'http://81.95.160.47/mt/oneway'
|
7
7
|
|
8
8
|
# URL for tracking SMS status.
|
9
9
|
SMS_TRACK_URL = 'http://81.95.160.47/bi/track.php'
|
@@ -26,10 +26,6 @@ module Magti
|
|
26
26
|
# service
|
27
27
|
attr_accessor :service
|
28
28
|
|
29
|
-
def initialize
|
30
|
-
self.service = 1
|
31
|
-
end
|
32
|
-
|
33
29
|
# Returns security options hash.
|
34
30
|
def security_options
|
35
31
|
{ :username => self.username, :password => self.password, :client_id => self.client, :service_id => self.service }
|
data/lib/magti/sms.rb
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
require 'set'
|
3
3
|
require 'cgi'
|
4
4
|
require 'httparty'
|
5
|
-
require 'c12-commons'
|
6
5
|
|
7
6
|
module Magti
|
8
7
|
|
@@ -29,12 +28,10 @@ module Magti
|
|
29
28
|
# @param text text to be sent
|
30
29
|
# @return Response object with response code and message ID
|
31
30
|
def self.send_sms(mobile, text)
|
32
|
-
raise ArgumentError, 'illegal mobile number' unless C12.correct_mobile?(mobile)
|
33
|
-
raise ArgumentError, 'max size exceeded' if text.length > Magti::MAX_SIZE
|
34
31
|
options = Magti.config.security_options
|
35
32
|
Magti.validate_security_options(options)
|
36
|
-
options = options.merge(:to => "995#{mobile}", :text => text)
|
37
|
-
http_resp = HTTParty.
|
33
|
+
options = options.merge(:to => "995#{mobile}", :text => text, :coding => 2)
|
34
|
+
http_resp = HTTParty.post(Magti::SMS_SEND_URL, {:body => options}).body
|
38
35
|
resp = Response.new
|
39
36
|
resp.code, resp.id = http_resp.split(' - ')
|
40
37
|
resp
|
@@ -48,5 +45,4 @@ module Magti
|
|
48
45
|
http_resp = HTTParty.get(Magti::SMS_TRACK_URL, {:query => options}).body
|
49
46
|
http_resp.to_i
|
50
47
|
end
|
51
|
-
|
52
48
|
end
|
data/lib/magti/version.rb
CHANGED
data/magti.gemspec
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magti
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1rc1
|
5
|
+
prerelease: 5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dimitri Kurashvili
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -27,22 +27,6 @@ dependencies:
|
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '2'
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: c12-commons
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
30
|
- !ruby/object:Gem::Dependency
|
47
31
|
name: httparty
|
48
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,12 +81,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
97
81
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
82
|
none: false
|
99
83
|
requirements:
|
100
|
-
- - ! '
|
84
|
+
- - ! '>'
|
101
85
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
86
|
+
version: 1.3.1
|
103
87
|
requirements: []
|
104
88
|
rubyforge_project:
|
105
|
-
rubygems_version: 1.8.
|
89
|
+
rubygems_version: 1.8.24
|
106
90
|
signing_key:
|
107
91
|
specification_version: 3
|
108
92
|
summary: Gem for sending SMS using MagtiGSM.ge gateway
|
@@ -110,4 +94,3 @@ test_files:
|
|
110
94
|
- spec/config_spec.rb
|
111
95
|
- spec/sms_spec.rb
|
112
96
|
- spec/spec_helper.rb
|
113
|
-
has_rdoc:
|