Class: Fog::Rackspace::CDNV2::Mock

Inherits:
Service
  • Object
show all
Includes:
MockData
Defined in:
lib/fog/rackspace/cdn_v2.rb

Constant Summary

Constants included from MockData

MockData::NOT_FOUND_ID

Instance Method Summary collapse

Methods included from MockData

#data, ipv4_address, ipv6_address, keep, slice, stringify, uuid, zulu_time

Methods inherited from Service

#authenticate, #endpoint_uri, #region, #request_without_retry, #service_name, #service_net?

Constructor Details

#initialize(options) ⇒ Mock

Returns a new instance of Mock.



35
36
37
38
# File 'lib/fog/rackspace/cdn_v2.rb', line 35

def initialize(options)
  @rackspace_api_key = options[:rackspace_api_key]
  @rackspace_region  = options[:rackspace_region]
end

Instance Method Details

#request(params) ⇒ Object



40
41
42
# File 'lib/fog/rackspace/cdn_v2.rb', line 40

def request(params)
  Fog::Mock.not_implemented
end

#response(params = {}) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/fog/rackspace/cdn_v2.rb', line 44

def response(params={})
  body    = params[:body] || {}
  status  = params[:status] || 200
  headers = params[:headers] || {}

  response = Excon::Response.new(:body => body, :headers => headers, :status => status)
  if params.key?(:expects) && ![*params[:expects]].include?(response.status)
    raise(Excon::Errors.status_error(params, response))
  else response
  end
end