Sha256: 465d900242eb7bb6d89a3ce36e736208fe0336451d067d79019da0029d376678
Contents?: true
Size: 1.51 KB
Versions: 1
Compression:
Stored size: 1.51 KB
Contents
# coding: utf-8 # # Author:: Alessio Rocchi (<alessio.rocchi@staff.aruba.it>) # © Copyright ArubaCloud. # # LICENSE: MIT (http://opensource.org/licenses/MIT) # module Fog module ArubaCloud class Service def datacenter raise Fog::Errors::NotImplemented.new('Please implement the #datacenter method') end def ws_enduser_url(url=nil) @ws_enduser_url = url || Fog::ArubaCloud::DEFAULT_WS_ENDUSER_URL end def _request(options) http_method = options[:http_method] || :get @request_url = "#{@ws_enduser_url}/#{options[:method]}" params = {headers: headers} params[:expects] = options[:expected] || [200, 201] unless options[:body].nil? params[:body] = options[:body] end params[:read_timeout] = 360 # initialize connection object @connection = Fog::Core::Connection.new(@request_url, false, params) # send request begin response = @connection.request(:method => http_method) @connection.reset rescue Excon::Errors::Timeout # raise an error raise Fog::ArubaCloud::Errors::RequestTimeOut.new( "Request timed out after: #{60 unless params[:read_timeout]}" ) end # decode the response and return it Fog::JSON.decode(response.body) end def headers(options={}) {'Content-Type' => 'application/json'}.merge(options[:headers] || {}) end def login end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-arubacloud-0.0.6 | lib/fog/arubacloud/service.rb |