httmultiparty 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -43,7 +43,7 @@ module HTTMultiParty
43
43
  def post(path, options={})
44
44
  method = Net::HTTP::Post
45
45
  options[:body] ||= options.delete(:query)
46
- if query_contains_files?(options[:body])
46
+ if hash_contains_files?(options[:body])
47
47
  method = MultipartPost
48
48
  options[:query_string_normalizer] = HTTMultiParty::QUERY_STRING_NORMALIZER
49
49
  end
@@ -53,7 +53,7 @@ module HTTMultiParty
53
53
  def put(path, options={})
54
54
  method = Net::HTTP::Put
55
55
  options[:body] ||= options.delete(:query)
56
- if query_contains_files?(options[:body])
56
+ if hash_contains_files?(options[:body])
57
57
  method = MultipartPut
58
58
  options[:query_string_normalizer] = HTTMultiParty::QUERY_STRING_NORMALIZER
59
59
  end
@@ -61,12 +61,15 @@ module HTTMultiParty
61
61
  end
62
62
 
63
63
  private
64
- def query_contains_files?(query)
65
- query.is_a?(Hash) && query.select { |k,v| v.is_a?(Hash) ? query_contains_files?(v) : (v.is_a?(File) || v.is_a?(UploadIO)) }.length > 0
64
+ def hash_contains_files?(hash)
65
+ hash.is_a?(Hash) && HTTMultiParty.flatten_params(hash).select do |(k,v)|
66
+ v.is_a?(File) || v.is_a?(UploadIO)
67
+ end.size > 0
66
68
  end
67
69
  end
68
70
  end
69
71
 
72
+ require 'httmultiparty/version'
70
73
  require 'httmultiparty/multipartable'
71
74
  require 'httmultiparty/multipart_post'
72
75
  require 'httmultiparty/multipart_put'
@@ -1,3 +1,3 @@
1
1
  module HTTMultiParty
2
- VERSION = '0.3.5'
2
+ VERSION = '0.3.6'
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: httmultiparty
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.5
5
+ version: 0.3.6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Johannes Wagener
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-17 00:00:00 +02:00
13
+ date: 2011-09-12 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency