conoha 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 0b25597425256fb33e5593b5a5de9b8f7e4c583b
4
- data.tar.gz: 195996c565758806f4d3a9eeab225d45515a5094
3
+ metadata.gz: 5d106d33ee7ffc508d7b8ff0bafd93fed38f81d4
4
+ data.tar.gz: 769fcb65ce90be7b0bf87dee78fd6586f862b0d8
5
5
  SHA512:
6
- metadata.gz: b332a0acb0ac8c9c45667588f2273384d7f14132ffca1d672f90aee39d7427c6c45d6e1032e2ce44b874cdf3f029b197022673310bec3611c065d4f8dc16eafd
7
- data.tar.gz: c6037d5f9ed0b08e3251a84803d7703a31495a5b2394686b4bddfdc53844ad9a32bcda2603aeff2eb7e36b731165023b93be9376840f197552e3e73099ba27ce
6
+ metadata.gz: 980120acc774cb59ced07ee731c031c7d7034288f4fbe27c8a8cb4a384f8910964d6880278b36a1f817891b5ee1334fcd54b029a7ade87b97b6e63fc7b5fca3d
7
+ data.tar.gz: 35d8922b6b2a66520db2e34e7dd797c34691c351d661b8cdde774e7b16ac13e3daa0882b0c6a41c24f7b45b666e22a361893c61389646c07e1327240a7337931
data/README.md CHANGED
@@ -127,7 +127,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/kaosf/
127
127
  - [x] delete image
128
128
  - [ ] public keys
129
129
  - [x] make as a gem
130
- - [ ] remove `curl` command from authenticate
130
+ - [x] remove `curl` command from authenticate
131
131
  - [ ] help message
132
132
  - [ ] subcommand help messages
133
133
 
data/lib/conoha.rb CHANGED
@@ -10,24 +10,12 @@ class Conoha
10
10
  end
11
11
 
12
12
  def self.authenticate!
13
- #uri = URI.parse 'https://identity.tyo1.conoha.io/v2.0/tokens'
14
- #https = Net::HTTP.new(uri.host, uri.port)
15
- #https.use_ssl = true
16
- #req = Net::HTTP::Post.new(uri.request_uri)
17
- #req['Content-Type'] = 'application/json'
18
- #payload = {
19
- # auth: {
20
- # passwordCredentials: {
21
- # username: $USERNAME,
22
- # password: $PASSWORD
23
- # },
24
- # tenant_id: $TENANT_ID
25
- # }
26
- #}.to_json
27
- #req.body = payload
28
- #res = https.request(req)
29
-
30
- req_json = JSON.generate({
13
+ uri = URI.parse 'https://identity.tyo1.conoha.io/v2.0/tokens'
14
+ https = Net::HTTP.new(uri.host, uri.port)
15
+ https.use_ssl = true
16
+ req = Net::HTTP::Post.new(uri.request_uri)
17
+ req['Content-Type'] = 'application/json'
18
+ payload = {
31
19
  auth: {
32
20
  passwordCredentials: {
33
21
  username: @@username,
@@ -35,18 +23,10 @@ class Conoha
35
23
  },
36
24
  tenantId: @@tenant_id
37
25
  }
38
- })
39
- command = <<EOS
40
- curl -X POST -H "Accept: application/json" \
41
- -d '#{req_json}' \
42
- https://identity.tyo1.conoha.io/v2.0/tokens 2> /dev/null
43
- EOS
44
- result = `#{command}`
45
-
46
- #token = JSON.parse(res.body)["access"]["token"]["id"]
47
- token = JSON.parse(result)["access"]["token"]["id"]
48
-
49
- @@authtoken = token
26
+ }.to_json
27
+ req.body = payload
28
+ res = https.request(req)
29
+ @@authtoken = JSON.parse(res.body)["access"]["token"]["id"]
50
30
  save_config!
51
31
  end
52
32
 
@@ -1,3 +1,3 @@
1
1
  module ConohaVersion
2
- ITSELF = "0.0.7"
2
+ ITSELF = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conoha
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - ka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-01 00:00:00.000000000 Z
11
+ date: 2015-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler