qingcloudserver 0.0.4 → 0.0.5

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: 8745c9b5dc4e954d06f75ec7e1eb4632be533145
4
- data.tar.gz: a078d4ec8184f40ab83c645b8ee050490480d35a
3
+ metadata.gz: 1ef17d989f31e0c2a3dbb6d2d21b283534fa85db
4
+ data.tar.gz: 2572d6e3168de051f94464f9517676f624847fb8
5
5
  SHA512:
6
- metadata.gz: b1f070e51bb94745fafdcbcb794fb9da6dd82f36c5847527e71f91631efb691ff1e17ad0731974aa1a691f86335288661558a13cd933961a930594762a7fd52a
7
- data.tar.gz: 0583c7f1698ba0478be4479f574f3a35c506edadda9417a4a359a87849fce62a5864ab53cb9d8961e780d0c552caf9f6476db18bf9851780e717e92a256bee35
6
+ metadata.gz: 33bb66ecdbe00f921f8db39e99d814eb441e73f314938a19b646fd34512ef576f6f0391de36c0488b6eed97c1b92e5a50be49b279719e3e6adc8764af157fe9c
7
+ data.tar.gz: b0205f6ee543abe2c0626f944e23ce8ef28740528bbf2ee9f9442463566bfc86d718ac7a4204feefb87ab57be15cec98eb4abb12bf8f1a2468c4aeb9d9ee2ad9
@@ -20,8 +20,12 @@ module QingCloudServer
20
20
  Connector.new(public_key, secret_key)
21
21
  end
22
22
 
23
+ def self.init_with_config
24
+ config_hash_file = Utility.read_config_file
25
+ Connector.new(config_hash_file["public_key"], config_hash_file["private_key"])
26
+ end
27
+
23
28
  def fetch_server_condition(action, params)
24
- # request_url = APIAddress + "&action=#{action}"
25
29
 
26
30
  params.update(
27
31
  :action => action,
@@ -1,3 +1,4 @@
1
- require 'client/service_foudation'
1
+ require 'client/service_foundation'
2
2
  require 'client/service'
3
3
  require 'client/connector'
4
+ require 'utility/setting'
@@ -0,0 +1,14 @@
1
+ require 'json'
2
+ module QingCloudServer
3
+ module Utility
4
+
5
+ CONFIG_FILE_PATH = "#{Dir.home}/.qingcloudserver/qingcloud.json"
6
+
7
+ def self.read_config_file
8
+ config_json_file = ""
9
+ File.open(CONFIG_FILE_PATH) {|file| config_json_file = file.read } if File.exist?(CONFIG_FILE_PATH)
10
+ JSON.parse(config_json_file)
11
+ end
12
+
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module QingCloudServer
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  require 'qingcloud_server'
2
2
 
3
- connector = QingCloudServer::Client::Connector.init("NULYIYWTTUXRAGENKRQM", "SKw7I862utQqhH98jTsKaxyWMybe2jrY0cF8EgE0")
3
+ connector = QingCloudServer::Client::Connector.init_with_config
4
4
  service = QingCloudServer::Client::Service.new(connector)
5
5
 
6
6
  # tj = status_N: ["running"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qingcloudserver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - gao yuehua
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-26 00:00:00.000000000 Z
11
+ date: 2015-08-27 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: another sdk for QingCloud servers
14
14
  email:
@@ -20,8 +20,9 @@ files:
20
20
  - README.md
21
21
  - lib/client/connector.rb
22
22
  - lib/client/service.rb
23
- - lib/client/service_foudation.rb
23
+ - lib/client/service_foundation.rb
24
24
  - lib/qingcloud_server.rb
25
+ - lib/utility/setting.rb
25
26
  - lib/version.rb
26
27
  - qingcloudserver.gemspec
27
28
  - test/server_test.rb