active_smsgate 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -102,13 +102,12 @@ module ActiveSmsgate #:nodoc:
102
102
  def deliver_sms(options = { :sender => nil})
103
103
  @options = {
104
104
  :action => "post_sms", :message => options[:message],
105
- :target => options[:phones],
106
- :sender => options[:sender] }
105
+ :target => options[:phones], :sender => options[:sender] }
107
106
 
108
107
  response = self.class.post("#{uri}/sendsms", :query => @options.merge(auth_options))
109
108
  xml = Zlib::GzipReader.new( StringIO.new( response ) ).read
110
109
  if response.code == 200
111
- parse(xml)
110
+ parse(xml)[:sms]
112
111
  else
113
112
  raise
114
113
  end
@@ -133,11 +132,11 @@ module ActiveSmsgate #:nodoc:
133
132
  def reply_sms(sms_id, sms_type = :sms)
134
133
  raise unless [:sms, :sms_group].include?(sms_type)
135
134
 
136
- @options = { :action => "status", :sendtype => "SENDSMS", "#{sms_type}_id" => sms_id }
135
+ @options = { :action => "status", :sendtype => "SENDSMS", "#{sms_type}_id".to_sym => sms_id }
137
136
  response = self.class.post("#{uri}/sendsms", :query => @options.merge(auth_options))
138
137
  xml = Zlib::GzipReader.new( StringIO.new( response ) ).read
139
138
  if response.code == 200
140
- parse(xml)
139
+ parse(xml)[:messages]
141
140
  else
142
141
  raise
143
142
  end
@@ -164,7 +163,7 @@ module ActiveSmsgate #:nodoc:
164
163
  doc.at("//output//result").each { |v,l| hash[v.downcase.to_sym] = l }
165
164
  x.each { |v,l| hash[v.downcase.to_sym] = l }
166
165
  hash[:text] = x.inner_html
167
- ::ResultSms::Result.new(hash.merge({ :sms_id => hash[:id], :sms_count => x[:sms_res_count]}))
166
+ ResultSms::Result.new(hash.merge({ :sms_id => hash[:id], :sms_count => x[:sms_res_count]}))
168
167
  }
169
168
 
170
169
  # Сообщения о доставках смс
@@ -173,7 +172,7 @@ module ActiveSmsgate #:nodoc:
173
172
  hash = { }
174
173
  x.each { |v,l| hash[v.downcase.to_sym] = l }
175
174
  x.children.each {|n| hash[n.name.downcase.to_sym] = n.inner_html unless n.blank? }
176
- ::ResultSms::Message.new(hash.merge({ :phone => hash[:sms_target], :sms_count => hash[:sms_res_count] }))
175
+ ResultSms::Message.new(hash.merge({ :phone => hash[:sms_target], :sms_count => hash[:sms_res_count] }))
177
176
  }
178
177
 
179
178
  # Сообщения об ошибках
@@ -195,7 +194,7 @@ module ActiveSmsgate #:nodoc:
195
194
  alias :failure? :failure
196
195
  define_method(:id){ @table[:id] || object_id}
197
196
  end
198
- class Result < OpenStruct;
197
+ class Result < OpenStruct
199
198
  define_method(:id){ @table[:id] || object_id}
200
199
  end
201
200
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pechnikov Maxim