Ensuring that multivalued requests in the AdSense Management API actually work
This commit is contained in:
parent
98c3d6e250
commit
c766975587
|
@ -550,7 +550,6 @@ describe Google::APIClient do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should succeed when validating repeated parameters in a correct call' do
|
it 'should succeed when validating repeated parameters in a correct call' do
|
||||||
# pending("This is caused by Faraday's encoding of query parameters.")
|
|
||||||
conn = stub_connection do |stub|
|
conn = stub_connection do |stub|
|
||||||
stub.get('/adsense/v1.3/reports?dimension=DATE&dimension=PRODUCT_CODE'+
|
stub.get('/adsense/v1.3/reports?dimension=DATE&dimension=PRODUCT_CODE'+
|
||||||
'&endDate=2010-01-01&metric=CLICKS&metric=PAGE_VIEWS&'+
|
'&endDate=2010-01-01&metric=CLICKS&metric=PAGE_VIEWS&'+
|
||||||
|
@ -587,6 +586,29 @@ describe Google::APIClient do
|
||||||
)
|
)
|
||||||
end).should raise_error(ArgumentError)
|
end).should raise_error(ArgumentError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should generate valid requests when multivalued parameters are passed' do
|
||||||
|
conn = stub_connection do |stub|
|
||||||
|
stub.get('/adsense/v1.3/reports?dimension=DATE&dimension=PRODUCT_CODE'+
|
||||||
|
'&endDate=2010-01-01&metric=CLICKS&metric=PAGE_VIEWS&'+
|
||||||
|
'startDate=2000-01-01') do |env|
|
||||||
|
env.params['dimension'].should include('DATE', 'PRODUCT_CODE')
|
||||||
|
env.params['metric'].should include('CLICKS', 'PAGE_VIEWS')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
request = CLIENT.execute(
|
||||||
|
:api_method => @adsense.reports.generate,
|
||||||
|
:parameters => {
|
||||||
|
'startDate' => '2000-01-01',
|
||||||
|
'endDate' => '2010-01-01',
|
||||||
|
'dimension' => ['DATE', 'PRODUCT_CODE'],
|
||||||
|
'metric' => ['PAGE_VIEWS', 'CLICKS']
|
||||||
|
},
|
||||||
|
:authenticated => false,
|
||||||
|
:connection => conn
|
||||||
|
)
|
||||||
|
conn.verify
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'with the Drive API' do
|
describe 'with the Drive API' do
|
||||||
|
|
Loading…
Reference in New Issue