lib/nationbuilder/client.rb in nationbuilder-rb-1.6.1 vs lib/nationbuilder/client.rb in nationbuilder-rb-1.6.2
- old
+ new
@@ -43,21 +43,19 @@
def raw_call(path, method, body = {}, args = {})
url = NationBuilder::URL.new(base_url).generate_url(path, args)
request_args = {
header: {
- 'Accept' => 'application/json',
- 'Content-Type' => 'application/json'
+ 'Accept' => 'application/json',
+ 'Content-Type' => 'application/json',
+ 'Authorization' => "Bearer #{@api_key}"
},
- query: {
- access_token: @api_key
- }
+ query: {}
}
if method == :get
- request_args[:query].merge!(body)
+ request_args[:query].merge!(NationBuilder::Utils::QueryParams.encode(body))
else
- body[:access_token] = @api_key
if !body[:fire_webhooks].nil?
request_args[:query][:fire_webhooks] = body[:fire_webhooks]
end
request_args[:body] = JSON(body)
end