Module: Fog::Vcloud::Generators

Included in:
Real
Defined in:
lib/fog/vcloud/generators.rb

Instance Method Summary collapse

Instance Method Details

#basic_request(*args) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fog/vcloud/generators.rb', line 18

def basic_request(*args)
  self.class_eval <<-EOS, __FILE__,__LINE__
    def #{args[0]}(uri)
      request({
        :expects => #{args[1] || 200},
        :method  => '#{args[2] || 'GET'}',
        :headers => #{args[3] ? args[3].inspect : '{}'},
        :body => '#{args[4] ? args[4] : ''}',
        :parse => true,
        :uri     => uri })
    end
  EOS
end

#unauthenticated_basic_request(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/fog/vcloud/generators.rb', line 5

def unauthenticated_basic_request(*args)
  self.class_eval <<-EOS, __FILE__,__LINE__
    def #{args[0]}(uri)
      unauthenticated_request({
        :expects => #{args[1] || 200},
        :method  => '#{args[2] || 'GET'}',
        :headers => #{args[3] ? args[3].inspect : '{}'},
        :parse => true,
        :uri     => uri })
    end
  EOS
end