messenger 0.4.4 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Messenger
2
- VERSION = '0.4.4'
2
+ VERSION = '0.5.0'
3
3
  end
data/lib/messenger/web.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'httparty'
2
+ require 'cgi'
2
3
 
3
4
  class Messenger::Web
4
5
 
@@ -15,9 +16,15 @@ class Messenger::Web
15
16
  # The body of the message is posted as the body of the request, not the query.
16
17
  def self.deliver(url, body, options={})
17
18
  raise Messenger::URLError, "The URL provided is invalid" unless valid_url?(url)
18
- method = options.delete(:method) || :post
19
- options = options.merge(:basic_auth => {:username => URI.parse(url).user, :password => URI.parse(url).password}) if URI.parse(url).user && URI.parse(url).password
20
- response = HTTParty.send(method, url, options.merge(:body => body))
19
+ options = options.dup
20
+ method = options.delete(:method) || :post
21
+ uri = URI.parse(url)
22
+ user = CGI.unescape(uri.user) if uri.user
23
+ password = CGI.unescape(uri.password) if uri.password
24
+ options = options.merge(:basic_auth => {:username => user, :password => password}) if user || password
25
+ uri.user = nil if user
26
+ uri.password = nil if password
27
+ response = HTTParty.send(method, uri.to_s, options.merge(:body => body))
21
28
  Messenger::Result.new(success?(response), response)
22
29
  end
23
30
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: messenger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 4
9
- - 4
10
- version: 0.4.4
8
+ - 5
9
+ - 0
10
+ version: 0.5.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brandon Arbini
@@ -16,8 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-11-09 00:00:00 -08:00
20
- default_executable:
19
+ date: 2012-04-17 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
23
22
  name: scashin133-xmpp4r-simple
@@ -141,7 +140,6 @@ files:
141
140
  - README.markdown
142
141
  - Rakefile
143
142
  - bin/messenger
144
- has_rdoc: true
145
143
  homepage: http://github.com/zencoder/messenger
146
144
  licenses: []
147
145
 
@@ -171,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
169
  requirements: []
172
170
 
173
171
  rubyforge_project: messenger
174
- rubygems_version: 1.3.9.2
172
+ rubygems_version: 1.8.17
175
173
  signing_key:
176
174
  specification_version: 3
177
175
  summary: "Messenger: easy message sending"