Class: Aliyun::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/aliyun/common.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Service

Returns a new instance of Service.



16
17
18
19
20
21
22
23
# File 'lib/aliyun/common.rb', line 16

def initialize(options={})
  options[:service] ||= :ecs
  self.service = SERVICES[options[:service].to_sym]
  self.access_key_id = options[:access_key_id]
  self.access_key_secret = options[:access_key_secret]
  self.endpoint_url = options[:endpoint_url] || self.service.endpoint
  self.options = {:AccessKeyId => self.access_key_id}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/aliyun/common.rb', line 25

def method_missing(method, *args)
  if $DEBUG
    puts "Not Found Method: #{method}"
  end

  if args[0].nil?
    raise AliyunAPIException.new "Method missing: #{method}!"
  end

  call_aliyun_with_parameter(method, args[0])
end

Instance Attribute Details

#access_key_idObject

Returns the value of attribute access_key_id.



11
12
13
# File 'lib/aliyun/common.rb', line 11

def access_key_id
  @access_key_id
end

#access_key_secretObject

Returns the value of attribute access_key_secret.



11
12
13
# File 'lib/aliyun/common.rb', line 11

def access_key_secret
  @access_key_secret
end

#endpoint_urlObject

Returns the value of attribute endpoint_url.



13
14
15
# File 'lib/aliyun/common.rb', line 13

def endpoint_url
  @endpoint_url
end

#optionsObject

Returns the value of attribute options.



12
13
14
# File 'lib/aliyun/common.rb', line 12

def options
  @options
end

#serviceObject

Returns the value of attribute service.



14
15
16
# File 'lib/aliyun/common.rb', line 14

def service
  @service
end