1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

use Excon's idempotent option for gets and lists

This commit is contained in:
Kevin Olbrich 2014-01-10 03:30:31 +00:00
parent 411b5b1728
commit 8b9e491072
21 changed files with 44 additions and 22 deletions

View file

@ -2,17 +2,19 @@ module Fog
module Joyent
class Analytics
class Real
def describe_analytics
def describe_analytics(force = false)
@describe_analytics = nil if force
@describe_analytics ||= request(
:path => "#{@joyent_username}/analytics",
:method => "GET",
:expects => 200
:expects => 200,
:idempotent => true
)
end
end
class Mock
def describe_analytics
def describe_analytics(force = false)
response = Excon::Response.new
response.status = 200
response.body = self.data[:describe_analytics]

View file

@ -6,7 +6,8 @@ module Fog
request(
:path => "#{@joyent_username}/analytics/instrumentations/#{id}",
:method => "GET",
:expects => 200
:expects => 200,
:idempotent => true
)
end
end

View file

@ -7,6 +7,7 @@ module Fog
:path => url,
:method => 'GET',
:expects => 200,
:idempotent => true,
:query => {
:ndatapoints => ndatapoints,
:start_time => requested_start_time.to_i,

View file

@ -6,7 +6,8 @@ module Fog
request(
:path => "#{@joyent_username}/analytics/instrumentations",
:method => "GET",
:expects => 200
:expects => 200,
:idempotent => true
)
end
end

View file

@ -18,7 +18,8 @@ module Fog
def get_dataset
request(
:method => "GET",
:path => "/my/datasets"
:path => "/my/datasets",
:idempotent => true
)
end
end

View file

@ -19,7 +19,8 @@ module Fog
request(
:method => "GET",
:path => "/#{@joyent_username}/images/#{id}",
:expects => 200
:expects => 200,
:idempotent => true
)
end
end

View file

@ -20,7 +20,8 @@ module Fog
request(
:method => "GET",
:path => "/my/keys/#{keyid}",
:expects => 200
:expects => 200,
:idempotent => true
)
end
end

View file

@ -20,7 +20,8 @@ module Fog
request(
:method => "GET",
:path => "/my/machines/#{uuid}",
:expects => [200, 410]
:expects => [200, 410],
:idempotent => true
)
end
end

View file

@ -15,7 +15,8 @@ module Fog
request(
:path => "/my/machines/#{machine_id}/metadata",
:query => query
:query => query,
:idempotent => true
)
end

View file

@ -5,7 +5,8 @@ module Fog
def get_machine_snapshot(machine_id, snapshot_name)
request(
:path => "/my/machines/#{machine_id}/snapshots/#{snapshot_name}",
:method => "GET"
:method => "GET",
:idempotent => true
)
end
end

View file

@ -9,7 +9,8 @@ module Fog
:path => "/my/machines/#{machine_id}/tags/#{tagname}",
:method => "GET",
:headers => {"Accept" => "text/plain"},
:expects => 200
:expects => 200,
:idempotent => true
)
end

View file

@ -23,7 +23,8 @@ module Fog
request(
:method => "GET",
:path => "/my/packages/#{name}",
:expects => 200
:expects => 200,
:idempotent => true
)
end

View file

@ -7,7 +7,8 @@ module Fog
request(
:expects => 200,
:method => :'GET',
:path => '/my/datacenters'
:path => '/my/datacenters',
:idempotent => true
)
end
end # Real

View file

@ -15,7 +15,8 @@ module Fog
def list_datasets
request(
:method => "GET",
:path => "/my/datasets"
:path => "/my/datasets",
:idempotent => true
)
end
end

View file

@ -16,7 +16,8 @@ module Fog
request(
:method => "GET",
:path => "/#{@joyent_username}/images",
:expects => 200
:expects => 200,
:idempotent => true
)
end
end

View file

@ -15,7 +15,8 @@ module Fog
request(
:expects => 200,
:method => :'GET',
:path => '/my/keys'
:path => '/my/keys',
:idempotent => true
)
end
end # Real

View file

@ -5,7 +5,8 @@ module Fog
def list_machine_snapshots(machine_id)
request(
:method => "GET",
:path => "/my/machines/#{machine_id}/snapshots"
:path => "/my/machines/#{machine_id}/snapshots",
:idempotent => true
)
end
end

View file

@ -7,7 +7,8 @@ module Fog
request(
:path => "/my/machines/#{machine_id}/tags",
:method => "GET",
:expects => 200
:expects => 200,
:idempotent => true
)
end
end

View file

@ -17,7 +17,8 @@ module Fog
:path => "/my/machines",
:method => "GET",
:query => options,
:expects => 200
:expects => 200,
:idempotent => true
)
end
end

View file

@ -17,7 +17,8 @@ module Fog
:path => "/my/networks",
:method => "GET",
:query => options,
:expects => 200
:expects => 200,
:idempotent => true
)
end
end

View file

@ -25,7 +25,8 @@ module Fog
request(
:path => "/my/packages",
:method => "GET",
:expects => 200
:expects => 200,
:idempotent => true
)
end
end # Real