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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a805b89ca19114aead114bef90692bb47509284b
4
- data.tar.gz: 07cf88b87738018220613dfad3ff8311375947ed
3
+ metadata.gz: 5699ff9f351b5d069a6426915b9a4c1673ca7318
4
+ data.tar.gz: caa65d9c3c386c307085446315c4b21656fd352e
5
5
  SHA512:
6
- metadata.gz: 6230f046f2ead04118c213a12e0ca24189d45cef2d61eac2cec82fbc95e44906d24acf4a8fd17d758ff34f4cff4ea2592dced3ab4c4005b4bd4d628d722e8c3c
7
- data.tar.gz: 0a89ea42ac4b7db3f29e6643f207aa59ea07135509be0afc64b090831eaa4e021d19605890e2f65ed1fc3498945493ea03371714438cad7757750fc7e3f671ef
6
+ metadata.gz: 7f455309fb404431fdb24355d3e29f5649fb4f2b56295a728964a8c57cb8e56e7e47513d8775d68a8f45b67c386e597c4efaf504dac7a6a313be4d07e6417d54
7
+ data.tar.gz: c44b832e460b910b97ece3376e69e2037594d8cf3521c7dffc37ff78dbf3a2b804bd15c5cb51c94006f6e9a4f8c1d095809ee6575e93430fb6cbcaa94ba93fcc
@@ -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
- args << params
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
@@ -1,5 +1,5 @@
1
1
  module ApipieBindings
2
2
  def self.version
3
- @version ||= Gem::Version.new '0.0.5'
3
+ @version ||= Gem::Version.new '0.0.6'
4
4
  end
5
5
  end
@@ -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
- RestClient::Response.expects(:create).with('', 200, [:post, {:file => s}, {}])
69
- result = api.http_call(:post, '/api/path', {:file => s}, {}, {:response => :raw})
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.5
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-20 00:00:00.000000000 Z
11
+ date: 2014-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json