Class: Aliyun::Service

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Service

Returns a new instance of Service.



26
27
28
29
30
31
32
33
34
35
# File 'lib/aliyun_ruby_api/service.rb', line 26

def initialize(options={})
  
  self.access_key_id = options[:access_key_id] || $ACCESS_KEY_ID || ""
  
  self.access_key_secret = options[:access_key_secret] || $ACCESS_KEY_SECRET || ""
  
  self.endpoint_url = options[:endpoint_url] || $ENDPOINT_URL || ALIYUN_API_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_name, *args) ⇒ Object

The method entry to call ECS url method



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/aliyun_ruby_api/service.rb', line 38

def method_missing(method_name, *args)
  if $DEBUG
    puts "Not Found Method: #{method_name}"
  end
  
  if args[0].nil?
    raise AliyunAPIException.new "No such  method  #{method_name}!"
  end
  
  call_aliyun_with_parameter(method_name, args[0])
end

Instance Attribute Details

#access_key_idObject

Returns the value of attribute access_key_id.



20
21
22
# File 'lib/aliyun_ruby_api/service.rb', line 20

def access_key_id
  @access_key_id
end

#access_key_secretObject

Returns the value of attribute access_key_secret.



22
23
24
# File 'lib/aliyun_ruby_api/service.rb', line 22

def access_key_secret
  @access_key_secret
end

#endpoint_urlObject

Returns the value of attribute endpoint_url.



24
25
26
# File 'lib/aliyun_ruby_api/service.rb', line 24

def endpoint_url
  @endpoint_url
end

#optionsObject

Returns the value of attribute options.



18
19
20
# File 'lib/aliyun_ruby_api/service.rb', line 18

def options
  @options
end