apis 0.5.0.pre1 → 0.5.1.pre1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/apis/adapter/net_http.rb +7 -7
- data/lib/apis/version.rb +1 -1
- data/lib/apis.rb +1 -1
- metadata +2 -2
@@ -4,21 +4,21 @@ module Apis
|
|
4
4
|
module Adapter
|
5
5
|
class NetHTTP
|
6
6
|
def call(env)
|
7
|
-
env[:
|
8
|
-
http = Net::HTTP.new(env[:
|
7
|
+
env[:uri].path = '/' if env[:uri].path.empty?
|
8
|
+
http = Net::HTTP.new(env[:uri].host, env[:uri].port)
|
9
9
|
query = Addressable::URI.new
|
10
10
|
query.query_values = env[:params]
|
11
11
|
response = case env[:method]
|
12
12
|
when :GET
|
13
|
-
http.get([env[:
|
13
|
+
http.get([env[:uri].path, query.query].compact.join('?'), env[:headers])
|
14
14
|
when :HEAD
|
15
|
-
http.head([env[:
|
15
|
+
http.head([env[:uri].path, query.query].compact.join('?'), env[:headers])
|
16
16
|
when :POST
|
17
|
-
http.post(env[:
|
17
|
+
http.post(env[:uri].path, query.query, env[:headers])
|
18
18
|
when :PUT
|
19
|
-
http.put(env[:
|
19
|
+
http.put(env[:uri].path, query.query, env[:headers])
|
20
20
|
when :DELETE
|
21
|
-
http.delete([env[:
|
21
|
+
http.delete([env[:uri].path, query.query].compact.join('?'), env[:headers])
|
22
22
|
end
|
23
23
|
|
24
24
|
[response.code.to_i, response, response.body]
|
data/lib/apis/version.rb
CHANGED
data/lib/apis.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: apis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease: 6
|
5
|
-
version: 0.5.
|
5
|
+
version: 0.5.1.pre1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- "Marjan Krekoten' (\xD0\x9C\xD0\xB0\xD1\x80'\xD1\x8F\xD0\xBD \xD0\x9A\xD1\x80\xD0\xB5\xD0\xBA\xD0\xBE\xD1\x82\xD0\xB5\xD0\xBD\xD1\x8C)"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-12 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|