messenger 0.4.4 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/messenger/version.rb +1 -1
- data/lib/messenger/web.rb +10 -3
- metadata +6 -8
data/lib/messenger/version.rb
CHANGED
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
|
-
|
19
|
-
|
20
|
-
|
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:
|
4
|
+
hash: 11
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
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:
|
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.
|
172
|
+
rubygems_version: 1.8.17
|
175
173
|
signing_key:
|
176
174
|
specification_version: 3
|
177
175
|
summary: "Messenger: easy message sending"
|