aliyun-api 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1887a58979178cebc960a86c6f55725a37689746
4
- data.tar.gz: f5a013e26a88226cfa4e1a8c41cb36f9f6038fe9
3
+ metadata.gz: 4514ca60a9c639dd8499f2d8858693d2b1abba55
4
+ data.tar.gz: 4778b715ab3ef2debd86e371d929eb16a411f075
5
5
  SHA512:
6
- metadata.gz: 40bee8a5ed81ef666e5f7045263e13d425604a21807feeee117b75657b027d06a18afff69f7078660be52c37cdba42053ac947cbcececeec28a98dd0a226bb40
7
- data.tar.gz: 52a9f5a0ccea503154f4ebcbb587823c9ba802cf7187d7690ae13878e4e499bea5f0c39ac6f769758195612f462232ab63c75a0611273a073a6a9d8c3c27d5c6
6
+ metadata.gz: 6a13a2ef97dec25fc91f3e5f0e641c7b19d6c6d43145b9b6449644b88a3f1fad765ac2fdcbb58ddd51476c402349d766c64d40fb52a946a0b96eeb74c8079565
7
+ data.tar.gz: 12352fbcc6734cf959b737204e84c4166563b39d9dc1e817bf85f59adada4ba8a32ac395e0d6759e3a1880d21c3e64520e928ad26cd65a56a85d7ecdbd5bf860
data/README.md CHANGED
@@ -28,7 +28,7 @@ require 'aliyun'
28
28
 
29
29
  ### 配置aliyun的access_key
30
30
 
31
- 1. 全局配置
31
+ #### 1. 全局配置
32
32
 
33
33
  ```
34
34
  options = {
@@ -39,7 +39,7 @@ Aliyun.config options
39
39
  ecs = Aliyun::ECS.new
40
40
  ```
41
41
 
42
- 2. 直接配置ECS客户端
42
+ #### 2. 直接配置ECS客户端
43
43
 
44
44
  ```
45
45
  options = {
@@ -49,9 +49,9 @@ options = {
49
49
  ecs = Aliyun::ECS.new options
50
50
  ```
51
51
 
52
- 3. 环境变量
52
+ #### 3. 环境变量
53
53
 
54
- 如果环境变量里`ACCESS_KEY_ID`和`ACCESS_KEY_SECRET`初始化了密钥,那么可以直接初始化ecs:
54
+ 如果环境变量里`ALIYUN_ACCESS_KEY_ID`和`ALIYUN_ACCESS_KEY_SECRET`初始化了密钥,那么可以直接初始化ecs:
55
55
 
56
56
  ```
57
57
  ecs = Aliyun::ECS.new
@@ -61,15 +61,12 @@ ecs = Aliyun::ECS.new
61
61
 
62
62
  这样, 你就可以根据 [阿里云弹性计算服务API参考手册](http://help.aliyun.com/view/11108189_13730407.html)初始化业务参数(除Action参数之外)为一个hash对象,并且将其作为参数传给Action方法(Action参数), action方法需要将阿里云手册中的Action名按ruby方式命名, 如:阿里云手册中的Action名`StartInstance`对应到这里的方法名为`start_instance`。
63
63
 
64
- ```
65
- parameters = {:parameter_name => parameter_value}
66
- ecs.action parameters
67
- ```
68
-
69
64
  (1) 例如查询可用地域列表,其Action参数为DescribeRegions,而没有其他参数,代码如下
70
65
 
71
66
  ```
72
67
  ecs.describe_regions {}
68
+ # 输出如下:
69
+ {"Regions"=>{"Region"=>[{"LocalName"=>"深圳", "RegionId"=>"cn-shenzhen"}, {"LocalName"=>"青岛", "RegionId"=>"cn-qingdao"}, {"LocalName"=>"北京", "RegionId"=>"cn-beijing"}, {"LocalName"=>"香港", "RegionId"=>"cn-hongkong"}, {"LocalName"=>"杭州", "RegionId"=>"cn-hangzhou"}]}, "RequestId"=>"abcdefg"}
73
70
  ```
74
71
 
75
72
  (2) 再比如查询可用镜像,代码如下
data/lib/aliyun.rb CHANGED
@@ -16,8 +16,8 @@ module Aliyun
16
16
  }
17
17
  self.request_method = 'GET'
18
18
  self.endpoint_url = 'https://ecs.aliyuncs.com/'
19
- self.access_key_id = ENV['ACCESS_KEY_ID']
20
- self.access_key_secret = ENV['ACCESS_KEY_SECRET']
19
+ self.access_key_id = ENV['ALIYUN_ACCESS_KEY_ID']
20
+ self.access_key_secret = ENV['ALIYUN_ACCESS_KEY_SECRET']
21
21
  end
22
22
  end
23
23
  def self.[](key)
data/lib/aliyun/ecs.rb CHANGED
@@ -10,8 +10,8 @@ require 'json'
10
10
  module Aliyun
11
11
  class ECS
12
12
  def initialize(options={})
13
- Aliyun[:access_key_id] = options[:access_key_id] || Aliyun[:access_key_id] || ENV['ACCESS_KEY_ID']
14
- Aliyun[:access_key_secret] = options[:access_key_secret] || Aliyun[:access_key_secret] || ENV['ACCESS_KEY_SECRET']
13
+ Aliyun[:access_key_id] = options[:access_key_id] || Aliyun[:access_key_id] || ENV['ALIYUN_ACCESS_KEY_ID']
14
+ Aliyun[:access_key_secret] = options[:access_key_secret] || Aliyun[:access_key_secret] || ENV['ALIYUN_ACCESS_KEY_SECRET']
15
15
  Aliyun[:endpoint_url] ||= options[:endpoint_url]
16
16
  end
17
17
 
@@ -1,3 +1,3 @@
1
1
  module Aliyun
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliyun-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - qjpcpu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-08 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler