niftycloud-restful-read-api 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -91,6 +91,11 @@ config.ru から require して使うこともできます。
91
91
  * /rdb/db_engine_versions
92
92
  * DB エンジンバージョン一覧を取得できます
93
93
 
94
+ ### MessageQueue
95
+
96
+ * /mq/queues
97
+ * キュー一覧を取得できます
98
+
94
99
  ## TODO
95
100
 
96
101
  * ニフティクラウド MQ/ESS/DNS/Automation
data/TODO ADDED
@@ -0,0 +1 @@
1
+ RDB, to_a が要らない
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -126,6 +126,23 @@ class NiftycloudRestfulReadApi < Sinatra::Base
126
126
  # [response.DescribeOrderableDBInstanceOptionsResult.OrderableDBInstanceOptions.OrderableDBInstanceOption.to_a].flatten rescue []
127
127
  #end
128
128
  end
129
+
130
+ class Mq
131
+ def initialize(options)
132
+ @api = NIFTY::Cloud::Base.new(
133
+ :access_key => options[:access_key_id],
134
+ :secret_key => options[:secret_access_key],
135
+ :server => "mq.jp-#{options[:region]}.api.cloud.nifty.com",
136
+ :path => '/'
137
+ )
138
+ end
139
+
140
+ # TODO: GetQueueAttributes
141
+ def queues
142
+ response = @api.send(:response_generator, 'Action' => 'ListQueues')
143
+ [response.ListQueuesResult.QueueUrl].flatten.map {|queue_url| {'QueueUrl' => queue_url} } rescue []
144
+ end
145
+ end
129
146
  end
130
147
 
131
148
  helpers do
@@ -144,6 +161,14 @@ class NiftycloudRestfulReadApi < Sinatra::Base
144
161
  :secret_access_key => @secret_access_key
145
162
  )
146
163
  end
164
+
165
+ def mq
166
+ @rdb ||= NiftyCloud::Mq.new(
167
+ :region => @region,
168
+ :access_key_id => @access_key_id,
169
+ :secret_access_key => @secret_access_key
170
+ )
171
+ end
147
172
  end
148
173
 
149
174
  before do
@@ -161,4 +186,9 @@ class NiftycloudRestfulReadApi < Sinatra::Base
161
186
  NIFTY::VERSION = '2013-05-15N2013-12-16'
162
187
  rdb.send(params[:resources]).to_json
163
188
  end
189
+
190
+ post '/mq/:resources' do
191
+ NIFTY::VERSION = '2012-11-05N2013-12-16'
192
+ mq.send(params[:resources]).to_json
193
+ end
164
194
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: niftycloud-restful-read-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2014-06-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &112748960 !ruby/object:Gem::Requirement
16
+ requirement: &227443700 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *112748960
24
+ version_requirements: *227443700
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: nifty-cloud-sdk
27
- requirement: &112748480 !ruby/object:Gem::Requirement
27
+ requirement: &227462700 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *112748480
35
+ version_requirements: *227462700
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &112748000 !ruby/object:Gem::Requirement
38
+ requirement: &227462220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *112748000
46
+ version_requirements: *227462220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &112747520 !ruby/object:Gem::Requirement
49
+ requirement: &227461740 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *112747520
57
+ version_requirements: *227461740
58
58
  description: NIFTYCloud の情報取得系 API を RESTful に利用できるようにする Sinatra アプリ
59
59
  email: tily05@gmail.com
60
60
  executables:
@@ -63,6 +63,7 @@ extensions: []
63
63
  extra_rdoc_files:
64
64
  - LICENSE.txt
65
65
  - README.md
66
+ - TODO
66
67
  files:
67
68
  - .document
68
69
  - Gemfile
@@ -75,6 +76,7 @@ files:
75
76
  - lib/niftycloud-restful-read-api.rb
76
77
  - test/helper.rb
77
78
  - test/test_nifty-cloud-restful-read-api.rb
79
+ - TODO
78
80
  homepage: http://github.com/tily/niftycloud-restful-read-api
79
81
  licenses:
80
82
  - MIT
@@ -90,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
92
  version: '0'
91
93
  segments:
92
94
  - 0
93
- hash: 1998930701841461656
95
+ hash: 801768762339487333
94
96
  required_rubygems_version: !ruby/object:Gem::Requirement
95
97
  none: false
96
98
  requirements: