motion-prime/api_client.rb in motion-prime-0.8.1 vs motion-prime/api_client.rb in motion-prime-0.8.2

- old
+ new

@@ -15,11 +15,11 @@ if config.http_auth? params.merge!(credentials: config.http_auth.to_hash) end if config.sign_request? signature = RmDigest::MD5.hexdigest( - config.signature_secret + params.keys.map(&:to_s).sort.join + config.signature_secret + filter_sign_params(params).keys.map(&:to_s).sort.join ) params.merge!(sign: signature) end params end @@ -35,11 +35,11 @@ use_callback = block_given? AFMotion::Client.shared.post(config.auth_path, request_params(data)) do |response| auth_data = response.object self.access_token = auth_data[:access_token] if auth_data - block.call(auth_data, response.operation.response.statusCode) if use_callback + block.call(auth_data, response.operation.response.try(:statusCode)) if use_callback end true end def page_url(path) @@ -109,9 +109,12 @@ options[:allow_queue] = true unless options.has_key?(:allow_queue) request(:delete, path, params, options, &block) end private + def filter_sign_params(params) + params.except(:_files) + end def config MotionPrime::Config.api_client end \ No newline at end of file