rfetion 0.3.13 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/rfetion/fetion.rb +12 -3
  3. data/rfetion.gemspec +2 -2
  4. metadata +2 -2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.13
1
+ 0.3.14
@@ -19,12 +19,17 @@ class Fetion
19
19
  @contacts = []
20
20
  @logger = Logger.new(STDOUT)
21
21
  @logger.level = Logger::INFO
22
+ @cat = true
22
23
  end
23
24
 
24
25
  def logger_level=(level)
25
26
  @logger.level = level
26
27
  end
27
28
 
29
+ def set_cat=(cat)
30
+ @cat = cat
31
+ end
32
+
28
33
  def Fetion.send_sms_to_self(mobile_no, password, content, level = Logger::INFO)
29
34
  fetion = Fetion.new
30
35
  fetion.logger_level = level
@@ -205,13 +210,13 @@ class Fetion
205
210
  end
206
211
 
207
212
  def send_sms(to, content)
208
- @logger.info "fetion send sms to #{to}"
209
- msg = sip_create('M fetion.com.cn SIP-C/2.0', {'F' => @sid, 'I' => next_call, 'Q' => '1 M', 'T' => to, 'N' => 'SendSMS'}, content) + FETION_SIPP
213
+ @logger.info "fetion #{send_command} to #{to}"
214
+ msg = sip_create('M fetion.com.cn SIP-C/2.0', {'F' => @sid, 'I' => next_call, 'Q' => '1 M', 'T' => to, 'N' => send_command}, content) + FETION_SIPP
210
215
  curl_exec(next_url, @ssic, msg)
211
216
  response = curl_exec(next_url, @ssic, FETION_SIPP)
212
217
 
213
218
  raise FetionException.new("Fetion Error: Send sms error") unless response.is_a? Net::HTTPSuccess
214
- @logger.info "fetion send sms to #{to} success"
219
+ @logger.info "fetion #{send_command} to #{to} success"
215
220
  end
216
221
 
217
222
  def add_buddy_with_mobile(mobile, nickname = nil)
@@ -298,5 +303,9 @@ class Fetion
298
303
  def next_call
299
304
  @next_call += 1
300
305
  end
306
+
307
+ def send_command
308
+ @cat ? 'SendCatSMS' : 'SendSMS'
309
+ end
301
310
  end
302
311
 
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.3.13"
8
+ s.version = "0.3.14"
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-11-28}
12
+ s.date = %q{2009-12-08}
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.3.13
4
+ version: 0.3.14
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-11-28 00:00:00 +08:00
12
+ date: 2009-12-08 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency