aliyun-rails 0.1.6 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc9b0f16743600223ebf29bd8ee89a81426ceeed7b3b04b364b07423ecf5dbed
4
- data.tar.gz: 6aa2dbbaefb12f8da964ca5a9b0d07e41e68272aaf2658521dbce89ee8d5c263
3
+ metadata.gz: 1142c76ee10a9c043b69a7bd38af493f5bea16be5ebf3c178992d8ad0a6ab77b
4
+ data.tar.gz: '061853f0ccc9663b9d5fce56d2714124a93bf6d797c0ff8de420091e46c6d5a3'
5
5
  SHA512:
6
- metadata.gz: 2ac70aece2de21d489e26720e8a02bd7aa41fea5fb489c97a2aeeb2afc26e31729487a6a4997ddb41a3543b5e29d34cb26a1d547b919c55ba348ccd9f6ec9d8d
7
- data.tar.gz: bec5d7f3fb133eb384545d9703ba26fc5d0962f1c0d0d07f63ed4ab6679cffa6aa1b03c570d7b0c4b56205677fbe8f3f8b271d41e38885a4972ef7c5adf32196
6
+ metadata.gz: 991bd34fca04f0271c2e4b5687bee642f64e33aaefda3a39e544f10ede9f27a2849ffe1a1a7974150f26aef4b6d5d7b525e207726cd9b29e922c9ecbf9f9e9eb
7
+ data.tar.gz: 8451cbb7129b84360376ddf2ab6edbffeb81b4ff7aed03b9d382294e22e51145d4793bc20d32c74b8b650fdc58087f668afba35b658bb13b0379bcddaffcdf19
@@ -10,21 +10,27 @@ module Aliyun
10
10
  module Rails
11
11
  module Connector
12
12
  class RPCClient
13
- attr_accessor :endpoint, :api_version, :access_key_id, :access_key_secret,
14
- :security_token, :codes, :opts, :verbose
13
+ # 类方法接受初始化变量
14
+ class << self
15
+ attr_accessor :access_key_id, :access_key_secret
15
16
 
16
- def init_params
17
- yield self
17
+ def configure
18
+ yield self
19
+ end
18
20
  end
19
21
 
22
+ attr_accessor :endpoint, :api_version, :access_key_id, :access_key_secret,
23
+ :security_token, :codes, :opts, :verbose
24
+
20
25
  # 对象初始化属性
21
- def initialize(config = init_params, verbose = false)
26
+ def initialize(verbose = false)
27
+ config = configure
22
28
  validate config
23
29
 
24
30
  self.endpoint = config[:endpoint]
25
31
  self.api_version = config[:api_version]
26
- self.access_key_id = config[:access_key_id]
27
- self.access_key_secret = config[:access_key_secret]
32
+ self.access_key_id = config[:access_key_id] || RPCClient.access_key_id
33
+ self.access_key_secret = config[:access_key_secret] || RPCClient.access_key_secret
28
34
  self.security_token = config[:security_token]
29
35
  self.opts = config[:opts] || {}
30
36
  self.verbose = verbose.instance_of?(TrueClass) && verbose
@@ -3,11 +3,13 @@
3
3
  module Aliyun
4
4
  module Rails
5
5
  class Dysms < Aliyun::Rails::Connector::RPCClient
6
+ attr_accessor :endpoint, :api_version
7
+
6
8
  # 本产品(Dysmsapi/2017-05-25)的OpenAPI采用RPC签名风格,签名细节参见签名机制说明。
7
9
  # 我们已经为开发者封装了常见编程语言的SDK,开发者可通过下载SDK直接调用本产品OpenAPI而无需关心技术细节。
8
- def initialize(config, verbose = nil)
9
- config["endpoint"] = "http://dysmsapi.aliyuncs.com"
10
- config["api_version"] = "2017-05-25"
10
+ def initialize(verbose = nil)
11
+ self.endpoint = "http://dysmsapi.aliyuncs.com"
12
+ self.api_version = "2017-05-25"
11
13
 
12
14
  super
13
15
  end
@@ -2,12 +2,14 @@
2
2
 
3
3
  module Aliyun
4
4
  module Rails
5
- class Dysms < Aliyun::Rails::Connector::RPCClient
5
+ class Dyvms < Aliyun::Rails::Connector::RPCClient
6
+ attr_accessor :endpoint, :api_version
7
+
6
8
  # 本产品(Dyvmsapi/2017-05-25)的OpenAPI采用RPC签名风格,签名细节参见签名机制说明。
7
9
  # 我们已经为开发者封装了常见编程语言的SDK,开发者可通过下载SDK直接调用本产品OpenAPI而无需关心技术细节。
8
- def initialize(config, verbose = nil)
9
- config["endpoint"] = "http://dyvmsapi.aliyuncs.com"
10
- config["api_version"] = "2017-05-25"
10
+ def initialize(verbose = nil)
11
+ self.endpoint = "http://dyvmsapi.aliyuncs.com"
12
+ self.api_version = "2017-05-25"
11
13
 
12
14
  super
13
15
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Aliyun
4
4
  module Rails
5
- VERSION = "0.1.6"
5
+ VERSION = "0.1.9"
6
6
  DEFAULT_UA = "AlibabaCloud (#{Gem::Platform.local.os}; " +
7
7
  "#{Gem::Platform.local.cpu}) Ruby/#{RUBY_VERSION} Core/#{VERSION}"
8
8
  end
data/lib/aliyun-rails.rb CHANGED
@@ -10,9 +10,10 @@ module Aliyun
10
10
  module Rails
11
11
  class Error < StandardError; end
12
12
 
13
+ # 模块方法接受代码块初始化参数
13
14
  class << self
14
15
  def config(&block)
15
- RPCClient.init_params(&block)
16
+ Aliyun::Rails::Connector::RPCClient.configure(&block)
16
17
  end
17
18
  end
18
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliyun-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - WENWU.YAN