rfetion 0.4.3 → 0.4.4
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.textile +33 -13
- data/VERSION +1 -1
- data/lib/rfetion/fetion.rb +11 -7
- data/rfetion.gemspec +2 -2
- metadata +2 -2
data/README.textile
CHANGED
@@ -24,30 +24,47 @@ h2. Usage
|
|
24
24
|
* send sms to friends or yourself
|
25
25
|
|
26
26
|
<pre><code>
|
27
|
-
Fetion.send_sms(
|
27
|
+
Fetion.send_sms(options)
|
28
28
|
</code></pre>
|
29
29
|
|
30
|
-
|
30
|
+
options can be:
|
31
|
+
<code>mobile_no</code>
|
32
|
+
<code>sid</code>
|
33
|
+
<code>password</code>
|
34
|
+
<code>receivers</code>, if receivers are nil, send sms to yourself
|
35
|
+
<code>content</code>
|
36
|
+
<code>logger_level</code>
|
31
37
|
|
32
|
-
|
38
|
+
|
39
|
+
* send schedule sms to friends
|
33
40
|
|
34
41
|
<pre><code>
|
35
|
-
Fetion.
|
42
|
+
Fetion.schedule_sms(options)
|
36
43
|
</code></pre>
|
37
44
|
|
38
|
-
|
45
|
+
options can be:
|
46
|
+
<code>mobile_no</code>
|
47
|
+
<code>sid</code>
|
48
|
+
<code>password</code>
|
49
|
+
<code>receivers</code>, if receivers are nil, send sms to yourself
|
50
|
+
<code>content</code>
|
51
|
+
<code>time</code>, time format is %Y-%m-%d %H:%M:%S
|
52
|
+
<code>logger_level</code>
|
39
53
|
|
40
|
-
<pre><code>
|
41
|
-
Fetion.add_buddy_with_sip(mobile_no, password, friend_sip)
|
42
|
-
</code></pre>
|
43
54
|
|
44
|
-
*
|
55
|
+
* add friend
|
45
56
|
|
46
57
|
<pre><code>
|
47
|
-
Fetion.
|
58
|
+
Fetion.add_buddy(options)
|
48
59
|
</code></pre>
|
49
60
|
|
50
|
-
|
61
|
+
options can be:
|
62
|
+
<code>mobile_no</code>
|
63
|
+
<code>sid</code>
|
64
|
+
<code>password</code>
|
65
|
+
<code>friend_mobile</code>
|
66
|
+
<code>friend_sip</code>
|
67
|
+
<code>logger_level</code>
|
51
68
|
|
52
69
|
**************************************************************************
|
53
70
|
|
@@ -59,21 +76,24 @@ you can use it in shell command directly
|
|
59
76
|
Usage: rfetion [options]
|
60
77
|
|
61
78
|
Example: rfetion -m mobile -p password -c sms_content
|
79
|
+
rfetion -s sip -p password -c sms_content
|
62
80
|
rfetion -m mobile -p password -r mobile_or_fetion_numbers -c sms_content
|
63
81
|
rfetion -m mobile -p password -r mobile_or_fetion_numbers -c sms_content -t time
|
64
82
|
rfetion -m mobile -p password --add-buddy-with-mobile friend_mobile
|
83
|
+
rfetion -s sip -p password --add-buddy-with-mobile friend_mobile
|
65
84
|
rfetion -m mobile -p password --add-buddy-with-sip friend_sip
|
66
85
|
|
86
|
+
|
67
87
|
-m, --mobile MOBILE Fetion mobile number
|
88
|
+
-s, --sip FETION_SIP Fetion sid number
|
68
89
|
-p, --password PASSWORD Fetion password
|
69
90
|
-c, --content CONTENT Fetion message content
|
70
|
-
-r, --receivers MOBILE,SIP
|
91
|
+
-r, --receivers MOBILE,SIP Receivers' Fetion mobile numbers or fetion sip numbers, if no recievers, send sms to yourself
|
71
92
|
-t, --time TIME Schedule time to send sms, format is "2009-12-10 20:00:00"
|
72
93
|
--add-buddy-with-mobile MOBILE
|
73
94
|
Add friend mobile as fetion friend
|
74
95
|
--add-buddy-with-sip SIP Add friend fetion sip as fetion friend
|
75
96
|
|
76
|
-
|
77
97
|
different mode:
|
78
98
|
--debug debug mode
|
79
99
|
--silence silence mode
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
data/lib/rfetion/fetion.rb
CHANGED
@@ -222,9 +222,11 @@ class Fetion
|
|
222
222
|
response = curl_exec(next_url, @ssic, FETION_SIPP)
|
223
223
|
raise FetionException.new("Fetion Error: Get buddy list error") unless response.is_a? Net::HTTPSuccess
|
224
224
|
|
225
|
-
|
226
|
-
|
227
|
-
|
225
|
+
response.body.scan(%r{<results>.*?</results>}).each do |results|
|
226
|
+
doc = REXML::Document.new(results)
|
227
|
+
doc.elements.each("results/contacts/allow-list/contact") do |contact|
|
228
|
+
@buddies << {:uri => contact.attributes["uri"]}
|
229
|
+
end
|
228
230
|
end
|
229
231
|
@logger.debug "buddies: #{@buddies.inspect}"
|
230
232
|
@logger.info "fetion get buddy list success"
|
@@ -247,10 +249,12 @@ class Fetion
|
|
247
249
|
break if response.body.size > FETION_SIPP.size
|
248
250
|
end
|
249
251
|
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
252
|
+
response.body.scan(%r{<results>.*?</results>}).each do |results|
|
253
|
+
doc = REXML::Document.new(results)
|
254
|
+
doc.elements.each("results/contacts/contact") do |contact|
|
255
|
+
attrs = contact.children.size == 0 ? {} : contact.children.first.attributes
|
256
|
+
@contacts << Contact.new(contact.attributes["uri"], attrs)
|
257
|
+
end
|
254
258
|
end
|
255
259
|
@logger.debug @contacts.inspect
|
256
260
|
@logger.info "fetion get contacts info success"
|
data/rfetion.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rfetion}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Richard Huang"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2010-01-22}
|
13
13
|
s.description = %q{rfetion is a ruby gem for China Mobile fetion service that you can send SMS free.}
|
14
14
|
s.email = %q{flyerhzm@gmail.com}
|
15
15
|
s.executables = ["rfetion", "rfetion"]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rfetion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-22 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|