nifcloud 0.0.2 → 0.0.3

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: 0afd39ff3b060348389f157e449de337dea88331
4
- data.tar.gz: 947d8505cea05bbe0f37a0cb31a4841c4820311b
3
+ metadata.gz: c9b5fcc118e08577f2a2e7d1028ecdf191586b89
4
+ data.tar.gz: d9ebe959043b2cbf5985e4474eb8c3b4f51fa3ab
5
5
  SHA512:
6
- metadata.gz: b425260f6b0b12f7c8607947de0fc7ae330d3396a91773569dafc2b927077c0a5e980ad9744d0b06ebc467de1ecf4bc73aa56f1baeb291a715c80ed346e1d586
7
- data.tar.gz: 9c160e5b1aaff8d118c949aaf673163614e73e24ff64bcb0060a5e2075e507e4c763ad386bc80caa65b1aef46b10ce4f47896b333dde751899ff60d2b4df0222
6
+ metadata.gz: ab3c4687c43876c4793b94c1bdfa75233b37ef72cdaaf249fb670ca20497a99f55a983c152268dc25df6cedb25b1724a744725b31328c73dbbbcac13dcc40f34
7
+ data.tar.gz: e6d9d43360cb78fee8fc078da5dd123edd62596f7843abef5282532c54c5b895c1659a5178d99fb5b095e2ec1dfcea1b5ff0dc069d5dac1065085da172efbfdd
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Kazuki Iwata
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md CHANGED
@@ -18,4 +18,12 @@ $ export NIFCLOUD_SECRET_ACCESS_KEY=YYYYYYYYYYYYYYYYYYY
18
18
  ```
19
19
  $ bundle install --path=vendor/bundle
20
20
  $ bundle exec rake
21
- ```
21
+ ```
22
+
23
+ ## Bug report or Feature request
24
+
25
+ Please file a ticket at the project web site.
26
+
27
+ 1. find a similar ticket from https://github.com/kzmake/nifcloud/issues
28
+ 1. create a new ticket by clicking 'Create Issue' button.
29
+ 1. you can use github features such as pull-request if you like.
@@ -0,0 +1,9 @@
1
+ require 'nifcloud'
2
+ require 'pp'
3
+
4
+ nc = Nifcloud.client(endpoint: 'https://computing.jp-west-1.api.cloud.nifty.com/api', debug: true)
5
+ res = nc.DescribeInstanceAttribute(InstanceId: 'test')
6
+
7
+ pp res
8
+
9
+ pp res.InstanceId
@@ -29,5 +29,30 @@ class Nifcloud::Client
29
29
  options[:Action] = 'StartInstances'
30
30
  get('/', query: options)
31
31
  end
32
+
33
+ def StopInstances(options={})
34
+ options[:Action] = 'StopInstances'
35
+ get('/', query: options)
36
+ end
37
+
38
+ def TerminateInstances(options={})
39
+ options[:Action] = 'TerminateInstances'
40
+ get('/', query: options)
41
+ end
42
+
43
+ def CopyInstances(options={})
44
+ options[:Action] = 'CopyInstances'
45
+ get('/', query: options)
46
+ end
47
+
48
+ def CancelCopyInstances(options={})
49
+ options[:Action] = 'CancelCopyInstances'
50
+ get('/', query: options)
51
+ end
52
+
53
+ def ImportInstance(options={})
54
+ options[:Action] = 'ImportInstance'
55
+ get('/', query: options)
56
+ end
32
57
  end
33
58
  end
@@ -90,19 +90,27 @@ module Nifcloud
90
90
  set_signature(options)
91
91
  end
92
92
 
93
- def set_timestamp(options)
94
- options[:query][:Timestamp] = Time.now.strftime("%Y%m%dT%H:%M:%SZ")
93
+ def set_timestamp(options={})
94
+ options[:query].merge!({
95
+ Timestamp: Time.now.strftime("%Y%m%dT%H:%M:%SZ"),
96
+ })
95
97
  end
96
98
 
97
- def set_access_key(options)
98
- options[:query][:AccessKeyId] = access_key
99
+ def set_access_key(options={})
100
+ raise Error::MissingCredentials.new("Please provide a access_key for user") unless @access_key
101
+ options[:query].merge!({
102
+ AccessKeyId: @access_key,
103
+ })
99
104
  end
100
105
 
101
- def set_signature(options)
106
+ def set_signature(options={})
107
+ raise Error::MissingCredentials.new("Please provide a secret_key for user") unless @secret_key
102
108
  key = @secret_key
103
109
  data = "#{options[:query][:Action]}#{options[:query][:Timestamp]}"
104
- options[:query][:Signature] = Signature.v0(key, data)
105
- options[:query][:SignatureVersion] = '0'
110
+ options[:query].merge!({
111
+ Signature: Signature.v0(key, data),
112
+ SignatureVersion: '0',
113
+ })
106
114
  end
107
115
  end
108
116
  end
@@ -1,3 +1,3 @@
1
1
  module Nifcloud
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nifcloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuki Iwata
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-15 00:00:00.000000000 Z
11
+ date: 2017-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,10 +105,12 @@ files:
105
105
  - ".rspec"
106
106
  - ".travis.yml"
107
107
  - Gemfile
108
+ - LICENSE.txt
108
109
  - README.md
109
110
  - Rakefile
110
111
  - bin/console
111
112
  - bin/setup
113
+ - examples/Instances/DescribeInstanceAttribute.rb
112
114
  - examples/Instances/DescribeInstances.rb
113
115
  - lib/nifcloud.rb
114
116
  - lib/nifcloud/api.rb