vodem_sms 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/changelog.md +3 -0
- data/lib/vodem_sms/commands.rb +25 -13
- data/lib/vodem_sms/headers.rb +17 -0
- data/lib/vodem_sms/message.rb +3 -0
- data/lib/vodem_sms/messages.rb +2 -12
- data/lib/vodem_sms/status_checker.rb +3 -8
- data/lib/vodem_sms/version.rb +1 -1
- data/lib/vodem_sms.rb +1 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b663b3e0bc7fe1dcfe944f66f3e2e699af7d751
|
4
|
+
data.tar.gz: b03aaffb816a849e545226dcf3f9f26991f04a78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3a49f4eb8e8c4badc9120694f85d79faaa60b8f880c2b4c8c0fc2f1b0726fa0daa4d7deee5755c82a8ca0413c5471d5989400d116f66e1e9bf2103a3304f543
|
7
|
+
data.tar.gz: ef456f9d5d0f55de1dfce9c4154aa6c9259f6361bb2b071eee928c037881c75ef1e5876bd874034aa874a0faa159d6aeb2b372e5fa803edd779aa88356c58644
|
data/README.md
CHANGED
@@ -35,6 +35,17 @@ There are just a couple of commands at the moment, connect!, disconnect!. Also
|
|
35
35
|
vodem.connect! #connect to the 3G network
|
36
36
|
vodem.disconnect! #disconnect from the 3G network
|
37
37
|
|
38
|
+
# messages
|
39
|
+
|
40
|
+
latest_message = vodem.latest_message
|
41
|
+
|
42
|
+
message.from # mobile number it was sent from
|
43
|
+
message.id # id of the mobile
|
44
|
+
message.sent_at # DateTime timestamp of when it was sent
|
45
|
+
message.content # the actual text of the message.
|
46
|
+
|
47
|
+
message.delete! # delete the message off the modem
|
48
|
+
|
38
49
|
```
|
39
50
|
|
40
51
|
## Contributing
|
data/changelog.md
CHANGED
data/lib/vodem_sms/commands.rb
CHANGED
@@ -1,20 +1,10 @@
|
|
1
1
|
module VodemSms
|
2
2
|
class Commands
|
3
|
-
|
4
|
-
WEBSERVER_HOST_HEADER = "192.168.9.1"
|
5
|
-
AGENT_HEADER = "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0'"
|
6
|
-
LANGUAGE_HEADER= "en-US,en;q=0.5"
|
7
|
-
ENCODING_HEADER = 'gzip, deflate'
|
8
|
-
CACHE_CONTROL_HEADER = 'no-cache'
|
9
|
-
CONNECTION_HEADER = 'keep-alive'
|
10
|
-
CONTENT_TYPE_HEADER = 'application/x-www-form-urlencoded; charset=UTF-8'
|
11
|
-
PRAGMA_HEADER = 'no-cache'
|
12
|
-
X_REQUESTED_WITH_HEADER = 'XMLHttpRequest'
|
13
|
-
REFERRER_HEADER = 'http://192.168.9.1/home.htm'
|
3
|
+
include VodemSms::Headers
|
14
4
|
|
15
5
|
def connect!
|
16
6
|
Typhoeus.post(
|
17
|
-
|
7
|
+
WEBSERVER_SET_CMD_URL,
|
18
8
|
headers: {
|
19
9
|
Host: WEBSERVER_HOST_HEADER,
|
20
10
|
"User-Agent" => AGENT_HEADER,
|
@@ -31,9 +21,31 @@ module VodemSms
|
|
31
21
|
sleep 10
|
32
22
|
end
|
33
23
|
|
24
|
+
def delete_message(id)
|
25
|
+
Typhoeus.post(
|
26
|
+
WEBSERVER_SET_CMD_URL,
|
27
|
+
headers: {
|
28
|
+
Host: WEBSERVER_HOST_HEADER,
|
29
|
+
"User-Agent" => AGENT_HEADER,
|
30
|
+
"Accept-Language" => LANGUAGE_HEADER,
|
31
|
+
"Accept-Encoding" => ENCODING_HEADER,
|
32
|
+
"Cache-Control" => CACHE_CONTROL_HEADER,
|
33
|
+
"Content-Type" => CONTENT_TYPE_HEADER,
|
34
|
+
"Pragma" => PRAGMA_HEADER,
|
35
|
+
"x-requested-with" => X_REQUESTED_WITH_HEADER,
|
36
|
+
"Referer" => REFERRER_HEADER,
|
37
|
+
Accept: "application/json"
|
38
|
+
},
|
39
|
+
body: {
|
40
|
+
goformId: "DELETE_SMS",
|
41
|
+
msg_id: id
|
42
|
+
}
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
34
46
|
def disconnect!
|
35
47
|
Typhoeus.post(
|
36
|
-
|
48
|
+
WEBSERVER_SET_CMD_URL,
|
37
49
|
headers: {
|
38
50
|
Host: WEBSERVER_HOST_HEADER,
|
39
51
|
"User-Agent" => AGENT_HEADER,
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module VodemSms
|
2
|
+
module Headers
|
3
|
+
WEBSERVER_SET_CMD_URL = "http://192.168.9.1/goform/goform_set_cmd_process"
|
4
|
+
WEBSERVER_GET_CMD_URL = "http://192.168.9.1/goform/goform_get_cmd_process"
|
5
|
+
|
6
|
+
AGENT_HEADER = "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0'"
|
7
|
+
CONTENT_TYPE_HEADER = 'application/x-www-form-urlencoded; charset=UTF-8'
|
8
|
+
CACHE_CONTROL_HEADER = 'no-cache'
|
9
|
+
CONNECTION_HEADER = 'keep-alive'
|
10
|
+
ENCODING_HEADER = 'gzip, deflate'
|
11
|
+
LANGUAGE_HEADER= "en-US,en;q=0.5"
|
12
|
+
PRAGMA_HEADER = 'no-cache'
|
13
|
+
REFERRER_HEADER = 'http://192.168.9.1/home.htm'
|
14
|
+
WEBSERVER_HOST_HEADER = "192.168.9.1"
|
15
|
+
X_REQUESTED_WITH_HEADER = 'XMLHttpRequest'
|
16
|
+
end
|
17
|
+
end
|
data/lib/vodem_sms/message.rb
CHANGED
data/lib/vodem_sms/messages.rb
CHANGED
@@ -2,21 +2,11 @@ require "vodem_sms/message"
|
|
2
2
|
|
3
3
|
module VodemSms
|
4
4
|
class Messages
|
5
|
-
|
6
|
-
WEBSERVER_HOST_HEADER = "192.168.9.1"
|
7
|
-
AGENT_HEADER = "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0'"
|
8
|
-
LANGUAGE_HEADER= "en-US,en;q=0.5"
|
9
|
-
ENCODING_HEADER = 'gzip, deflate'
|
10
|
-
CACHE_CONTROL_HEADER = 'no-cache'
|
11
|
-
CONNECTION_HEADER = 'keep-alive'
|
12
|
-
CONTENT_TYPE_HEADER = 'application/x-www-form-urlencoded; charset=UTF-8'
|
13
|
-
PRAGMA_HEADER = 'no-cache'
|
14
|
-
X_REQUESTED_WITH_HEADER = 'XMLHttpRequest'
|
15
|
-
REFERRER_HEADER = 'http://192.168.9.1/home.htm'
|
5
|
+
include VodemSms::Headers
|
16
6
|
|
17
7
|
def get_message
|
18
8
|
response = Typhoeus.get(
|
19
|
-
|
9
|
+
WEBSERVER_GET_CMD_URL,
|
20
10
|
headers: {
|
21
11
|
Host: WEBSERVER_HOST_HEADER,
|
22
12
|
"User-Agent" => AGENT_HEADER,
|
@@ -1,12 +1,7 @@
|
|
1
1
|
module VodemSms
|
2
2
|
class StatusChecker
|
3
|
-
|
4
|
-
|
5
|
-
AGENT_HEADER = "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:37.0) Gecko/20100101 Firefox/37.0'"
|
6
|
-
LANGUAGE_HEADER= "en-US,en;q=0.5"
|
7
|
-
ENCODING_HEADER = 'gzip, deflate'
|
8
|
-
X_REQUESTED_WITH_HEADER = 'XMLHttpRequest'
|
9
|
-
REFERRER_HEADER = 'http://192.168.9.1/home.htm'
|
3
|
+
include VodemSms::Headers
|
4
|
+
|
10
5
|
STATUS_FIELD = 'ppp_status'
|
11
6
|
|
12
7
|
class Status
|
@@ -38,7 +33,7 @@ module VodemSms
|
|
38
33
|
|
39
34
|
def get_status
|
40
35
|
response = Typhoeus.get(
|
41
|
-
|
36
|
+
WEBSERVER_GET_CMD_URL,
|
42
37
|
headers: {
|
43
38
|
Host: WEBSERVER_HOST_HEADER,
|
44
39
|
"User-Agent" => AGENT_HEADER,
|
data/lib/vodem_sms/version.rb
CHANGED
data/lib/vodem_sms.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vodem_sms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Davey
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- lib/vodem_sms.rb
|
158
158
|
- lib/vodem_sms/commands.rb
|
159
159
|
- lib/vodem_sms/errors.rb
|
160
|
+
- lib/vodem_sms/headers.rb
|
160
161
|
- lib/vodem_sms/message.rb
|
161
162
|
- lib/vodem_sms/messages.rb
|
162
163
|
- lib/vodem_sms/status_checker.rb
|