Class: Fog::Rackspace::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/fog/rackspace/service.rb

Instance Method Summary collapse

Instance Method Details

#authenticate(options = {}) ⇒ Object



29
30
31
# File 'lib/fog/rackspace/service.rb', line 29

def authenticate(options={})
   self.send authentication_method, options
end

#endpoint_uri(service_endpoint = nil, endpoint_name = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fog/rackspace/service.rb', line 13

def endpoint_uri(service_endpoint=nil, endpoint_name=nil)
  return @uri if @uri

  url = service_endpoint

  unless url
    if v1_authentication?
      raise "Service Endpoint must be specified via #{endpoint_name} parameter"
    else
      url = endpoint_uri_v2
    end
  end

  @uri = URI.parse url
end

#regionObject



9
10
11
# File 'lib/fog/rackspace/service.rb', line 9

def region
  raise Fog::Errors::NotImplemented.new("Please implement the #region method")
end

#request(params, parse_json = true) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/fog/rackspace/service.rb', line 40

def request(params, parse_json = true)
  first_attempt = true
  begin
    response = @connection.request(request_params(params))
  rescue Excon::Errors::Unauthorized => error
    raise error unless first_attempt
    first_attempt = false
    authenticate
    retry
  end

  process_response(response) if parse_json
  response
end

#request_without_retry(params, parse_json = true) ⇒ Object



33
34
35
36
37
38
# File 'lib/fog/rackspace/service.rb', line 33

def request_without_retry(params, parse_json = true)
  response = @connection.request(request_params(params))

  process_response(response) if parse_json
  response
end

#service_nameObject



5
6
7
# File 'lib/fog/rackspace/service.rb', line 5

def service_name
  raise Fog::Errors::NotImplemented.new("Please implement the #service_name method")
end

#service_net?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/fog/rackspace/service.rb', line 55

def service_net?
  false
end