rfetion 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
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(mobile_no, password, mobile_or_fetion_numbers, content)
27
+ Fetion.send_sms(options)
28
28
  </code></pre>
29
29
 
30
- if mobile_or_fetion_numbers are nil, send sms to yourself.
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
- * add friend with mobile
38
+
39
+ * send schedule sms to friends
33
40
 
34
41
  <pre><code>
35
- Fetion.add_buddy_with_mobile(mobile_no, password, friend_mobile)
42
+ Fetion.schedule_sms(options)
36
43
  </code></pre>
37
44
 
38
- * add friend with sip
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
- * send schedule sms to friends
55
+ * add friend
45
56
 
46
57
  <pre><code>
47
- Fetion.schedule_sms(mobile_no, password, mobile_or_fetion_number, content, time)
58
+ Fetion.add_buddy(options)
48
59
  </code></pre>
49
60
 
50
- Time format is %Y-%m-%d %H:%M:%S
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 (optional) Receivers' Fetion mobile numbers or fetion sip numbers, if no recievers, send sms to yourself
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.3
1
+ 0.4.4
@@ -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
- doc = REXML::Document.new(response.body.chomp(FETION_SIPP))
226
- doc.elements.each("results/contacts/allow-list/contact") do |contact|
227
- @buddies << {:uri => contact.attributes["uri"]}
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
- doc = REXML::Document.new(response.body.chomp(FETION_SIPP))
251
- doc.elements.each("results/contacts/contact") do |contact|
252
- attrs = contact.children.size == 0 ? {} : contact.children.first.attributes
253
- @contacts << Contact.new(contact.attributes["uri"], attrs)
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.3"
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{2009-12-17}
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.3
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: 2009-12-17 00:00:00 +08:00
12
+ date: 2010-01-22 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency