apipie-bindings 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apipie_bindings/api.rb +8 -1
- data/lib/apipie_bindings/version.rb +1 -1
- data/test/unit/api_test.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5699ff9f351b5d069a6426915b9a4c1673ca7318
|
4
|
+
data.tar.gz: caa65d9c3c386c307085446315c4b21656fd352e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f455309fb404431fdb24355d3e29f5649fb4f2b56295a728964a8c57cb8e56e7e47513d8775d68a8f45b67c386e597c4efaf504dac7a6a313be4d07e6417d54
|
7
|
+
data.tar.gz: c44b832e460b910b97ece3376e69e2037594d8cf3521c7dffc37ff78dbf3a2b804bd15c5cb51c94006f6e9a4f8c1d095809ee6575e93430fb6cbcaa94ba93fcc
|
data/lib/apipie_bindings/api.rb
CHANGED
@@ -35,6 +35,7 @@ module ApipieBindings
|
|
35
35
|
# if the local cache of API description (JSON) is up to date. By default it is checked
|
36
36
|
# *after* each API request
|
37
37
|
# @option config [Object] :logger (Logger.new(STDERR)) custom logger class
|
38
|
+
# @option config [Number] :timeout API request timeout in seconds
|
38
39
|
# @param [Hash] options params that are passed to ResClient as-is
|
39
40
|
# @raise [ApipieBindings::ConfigurationError] when no +:uri+ or +:apidoc_cache_dir+ is provided
|
40
41
|
# @example connect to a server
|
@@ -75,6 +76,7 @@ module ApipieBindings
|
|
75
76
|
:user => config[:username],
|
76
77
|
:password => config[:password],
|
77
78
|
:oauth => config[:oauth],
|
79
|
+
:timeout => config[:timeout],
|
78
80
|
:headers => headers
|
79
81
|
}.merge(options)
|
80
82
|
|
@@ -171,7 +173,12 @@ module ApipieBindings
|
|
171
173
|
|
172
174
|
args = [http_method]
|
173
175
|
if %w[post put].include?(http_method.to_s)
|
174
|
-
|
176
|
+
#If using multi-part forms, the paramaters should not be json
|
177
|
+
if ((headers.include?(:content_type)) and (headers[:content_type] == "multipart/form-data"))
|
178
|
+
args << params
|
179
|
+
else
|
180
|
+
args << params.to_json
|
181
|
+
end
|
175
182
|
else
|
176
183
|
headers[:params] = params if params
|
177
184
|
end
|
data/test/unit/api_test.rb
CHANGED
@@ -65,8 +65,9 @@ describe ApipieBindings::API do
|
|
65
65
|
:apidoc_cache_name => 'architecture',
|
66
66
|
:dry_run => true})
|
67
67
|
s = StringIO.new; s << 'foo'
|
68
|
-
|
69
|
-
|
68
|
+
headers = {:content_type => 'multipart/form-data', :multipart => true}
|
69
|
+
RestClient::Response.expects(:create).with('', 200, [:post, {:file => s}, headers])
|
70
|
+
result = api.http_call(:post, '/api/path', {:file => s}, headers, {:response => :raw})
|
70
71
|
end
|
71
72
|
|
72
73
|
context "update_cache" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-bindings
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Bačovský
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-03-
|
11
|
+
date: 2014-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|