Upgrade to Faraday 0.9 (fixes params encoding problems)

This commit is contained in:
Steven Bazyl committed 2013-05-13 14:03:49 -07:00
1 parent 9cd5601134
commit 794c6a90f7
11 files changed
+53 -49

No files matched your search

@@ -187,6 +187,7 @@ module Google
# @return [Addressable::URI] The URI after expansion.
def generate_uri(parameters={})
parameters = self.normalize_parameters(parameters)
self.validate_parameters(parameters)
template_variables = self.uri_template.variables
upload_type = parameters.assoc('uploadType') || parameters.assoc('upload_type')
+7 -5
View File
@@ -14,6 +14,8 @@
require 'faraday'
require 'faraday/utils'
require 'faraday/options'
require 'faraday/request/multipart'
require 'multi_json'
require 'compat/multi_json'
require 'addressable/uri'
@@ -71,7 +73,7 @@ module Google
# @option options [String, Symbol] :http_method
# HTTP method when requesting a URI
def initialize(options={})
@parameters = Hash[options[:parameters] || {}]
@parameters = Faraday::Utils::ParamsHash[options[:parameters] || {}]
@headers = Faraday::Utils::Headers.new
self.headers.merge!(options[:headers]) unless options[:headers].nil?
self.api_method = options[:api_method]
@@ -314,10 +316,10 @@ module Google
# @param [String] boundary
# Boundary for separating each part of the message
def build_multipart(parts, mime_type = 'multipart/related', boundary = MULTIPART_BOUNDARY)
env = {
:request_headers => {'Content-Type' => "#{mime_type};boundary=#{boundary}"},
:request => { :boundary => boundary }
}
env = Faraday::Env.new
env.request = Faraday::RequestOptions.new
env.request.boundary = boundary
env.request_headers = {'Content-Type' => "#{mime_type};boundary=#{boundary}"}
multipart = Faraday::Request::Multipart.new
self.body = multipart.create_multipart(env, parts.map {|part| [nil, part]})
self.headers.update(env[:request_headers])
+2 -2
View File
@@ -21,8 +21,8 @@ if !defined?(::Google::APIClient::VERSION)
class APIClient
module VERSION
MAJOR = 0
MINOR = 6
TINY = 3
MINOR = 7
TINY = 0
STRING = [MAJOR, MINOR, TINY].join('.')
end
end