lib/her/api.rb in her-0.3.6 vs lib/her/api.rb in her-0.3.7
- old
+ new
@@ -37,11 +37,11 @@
#
# @example A custom parse middleware
# class MyCustomParser < Faraday::Response::Middleware
# def on_complete(env)
# json = JSON.parse(env[:body], :symbolize_names => true)
- # errors = json.delete(:errors) || []
+ # errors = json.delete(:errors) || {}
# metadata = json.delete(:metadata) || []
# env[:body] = { :data => json, :errors => errors, :metadata => metadata }
# end
# end
# Her::API.setup :url => "https://api.example.com" do |connection|
@@ -57,10 +57,10 @@
yield connection if block_given?
end
end
# Define a custom parsing procedure. The procedure is passed the response object and is
- # expected to return a hash with three keys: a main data Hash, an errors Array
+ # expected to return a hash with three keys: a main data Hash, an errors Hash
# and a metadata Hash.
#
# @private
def request(attrs={})
method = attrs.delete(:_method)