megam_api 0.100 → 1.5.beta2
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 +4 -4
- data/README.md +5 -69
- data/lib/megam/api.rb +15 -37
- data/lib/megam/api/errors.rb +19 -19
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/account.rb +1 -1
- data/lib/megam/core/assemblies.rb +1 -1
- data/lib/megam/core/assemblies_collection.rb +7 -15
- data/lib/megam/core/assembly.rb +1 -1
- data/lib/megam/core/assembly_collection.rb +7 -15
- data/lib/megam/core/balances.rb +1 -1
- data/lib/megam/core/balances_collection.rb +8 -16
- data/lib/megam/core/billedhistories.rb +1 -1
- data/lib/megam/core/billedhistories_collection.rb +7 -15
- data/lib/megam/core/components.rb +1 -1
- data/lib/megam/core/components_collection.rb +103 -110
- data/lib/megam/core/domain_collection.rb +102 -109
- data/lib/megam/core/domains.rb +1 -1
- data/lib/megam/core/error.rb +1 -15
- data/lib/megam/core/json_compat.rb +170 -208
- data/lib/megam/core/marketplace.rb +1 -1
- data/lib/megam/core/marketplace_collection.rb +7 -16
- data/lib/megam/core/organizations.rb +1 -1
- data/lib/megam/core/organizations_collection.rb +8 -40
- data/lib/megam/core/promos.rb +1 -1
- data/lib/megam/core/request.rb +1 -1
- data/lib/megam/core/request_collection.rb +7 -16
- data/lib/megam/core/rest_adapter.rb +54 -0
- data/lib/megam/core/sensors.rb +1 -1
- data/lib/megam/core/sensors_collection.rb +7 -14
- data/lib/megam/core/sshkey.rb +1 -1
- data/lib/megam/core/sshkey_collection.rb +103 -110
- data/lib/megam/core/stuff.rb +2 -34
- data/lib/megam/core/text.rb +1 -0
- data/lib/megam/core/text_formatter.rb +2 -1
- data/megam_api.gemspec +2 -2
- metadata +10 -56
- data/lib/megam/api/availableunits.rb +0 -50
- data/lib/megam/api/billings.rb +0 -50
- data/lib/megam/api/credithistories.rb +0 -50
- data/lib/megam/api/csars.rb +0 -75
- data/lib/megam/api/discounts.rb +0 -50
- data/lib/megam/api/invoices.rb +0 -50
- data/lib/megam/api/login.rb +0 -29
- data/lib/megam/api/subscriptions.rb +0 -50
- data/lib/megam/core/auth.rb +0 -91
- data/lib/megam/core/availableunits.rb +0 -182
- data/lib/megam/core/availableunits_collection.rb +0 -144
- data/lib/megam/core/billings.rb +0 -242
- data/lib/megam/core/billings_collection.rb +0 -144
- data/lib/megam/core/config.rb +0 -41
- data/lib/megam/core/credithistories.rb +0 -191
- data/lib/megam/core/credithistories_collection.rb +0 -144
- data/lib/megam/core/csar.rb +0 -179
- data/lib/megam/core/csar_collection.rb +0 -148
- data/lib/megam/core/discounts.rb +0 -204
- data/lib/megam/core/discounts_collection.rb +0 -164
- data/lib/megam/core/invoices.rb +0 -231
- data/lib/megam/core/invoices_collection.rb +0 -144
- data/lib/megam/core/server_api.rb +0 -52
- data/lib/megam/core/subscriptions.rb +0 -191
- data/lib/megam/core/subscriptions_collection.rb +0 -144
- data/test/test_availableunits.rb +0 -28
- data/test/test_billings.rb +0 -33
- data/test/test_cat_requests.rb +0 -20
- data/test/test_credithistories.rb +0 -29
- data/test/test_csars.rb +0 -22
- data/test/test_discounts.rb +0 -31
- data/test/test_invoices.rb +0 -31
- data/test/test_login.rb +0 -10
- data/test/test_marketplaceaddons.rb +0 -46
- data/test/test_predefclouds.rb +0 -80
- data/test/test_subscriptions.rb +0 -29
data/lib/megam/core/stuff.rb
CHANGED
@@ -27,43 +27,11 @@ module Megam
|
|
27
27
|
%x{ git #{flattened_args} 2>&1 }.strip
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
if since.is_a?(String)
|
32
|
-
since = Time.parse(since)
|
33
|
-
end
|
34
|
-
|
35
|
-
elapsed = Time.now - since
|
36
|
-
|
37
|
-
message = since.strftime("%Y/%m/%d %H:%M:%S")
|
38
|
-
if elapsed <= 60
|
39
|
-
message << " (~ #{elapsed.floor}s ago)"
|
40
|
-
elsif elapsed <= (60 * 60)
|
41
|
-
message << " (~ #{(elapsed / 60).floor}m ago)"
|
42
|
-
elsif elapsed <= (60 * 60 * 25)
|
43
|
-
message << " (~ #{(elapsed / 60 / 60).floor}h ago)"
|
44
|
-
end
|
45
|
-
message
|
46
|
-
end
|
47
|
-
|
48
|
-
def spinner(ticks)
|
49
|
-
%w(/ - \\ |)[ticks % 4]
|
50
|
-
end
|
51
|
-
|
52
|
-
def launchy(message, url)
|
53
|
-
action(message) do
|
54
|
-
require("launchy")
|
55
|
-
launchy = Launchy.open(url)
|
56
|
-
if launchy.respond_to?(:join)
|
57
|
-
launchy.join
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
30
|
+
#
|
63
31
|
#left justified keyed hash with newlines.
|
64
32
|
def styled_hash(hash)
|
65
33
|
hash.map{|k,v| "#{k.ljust(15)}=#{v}"}.join("\n")
|
66
34
|
end
|
67
35
|
|
68
36
|
end
|
69
|
-
end
|
37
|
+
end
|
data/lib/megam/core/text.rb
CHANGED
@@ -3,6 +3,7 @@ module Megam
|
|
3
3
|
|
4
4
|
attr_reader :data
|
5
5
|
attr_reader :ui
|
6
|
+
|
6
7
|
def initialize(data, ui)
|
7
8
|
@ui = ui
|
8
9
|
@data = if data.respond_to?(:display_hash)
|
@@ -58,6 +59,6 @@ module Megam
|
|
58
59
|
def is_singleton(value)
|
59
60
|
!(value.kind_of?(Array) || value.respond_to?(:keys))
|
60
61
|
end
|
61
|
-
|
62
|
+
|
62
63
|
end
|
63
64
|
end
|
data/megam_api.gemspec
CHANGED
@@ -16,9 +16,9 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
17
17
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
18
18
|
s.require_paths = ["lib"]
|
19
|
-
s.add_runtime_dependency 'excon', '~> 0.
|
19
|
+
s.add_runtime_dependency 'excon', '~> 0.49.0'
|
20
20
|
s.add_runtime_dependency 'highline', '~> 1.7'
|
21
|
-
s.add_runtime_dependency 'yajl
|
21
|
+
s.add_runtime_dependency 'ffi-yajl', '~> 2.2'
|
22
22
|
s.add_runtime_dependency 'mixlib-config', '~> 2.2'
|
23
23
|
s.add_runtime_dependency 'mixlib-log', '~> 1.6'
|
24
24
|
s.add_development_dependency 'minitest', '~> 5.8'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: megam_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.5.beta2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan,
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 0.49.0
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 0.49.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: highline
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,19 +40,19 @@ dependencies:
|
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '1.7'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name: yajl
|
43
|
+
name: ffi-yajl
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
48
|
+
version: '2.2'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
55
|
+
version: '2.2'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: mixlib-config
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,54 +136,32 @@ files:
|
|
136
136
|
- lib/megam/api/accounts.rb
|
137
137
|
- lib/megam/api/assemblies.rb
|
138
138
|
- lib/megam/api/assembly.rb
|
139
|
-
- lib/megam/api/availableunits.rb
|
140
139
|
- lib/megam/api/balances.rb
|
141
140
|
- lib/megam/api/billedhistories.rb
|
142
|
-
- lib/megam/api/billings.rb
|
143
141
|
- lib/megam/api/components.rb
|
144
|
-
- lib/megam/api/credithistories.rb
|
145
|
-
- lib/megam/api/csars.rb
|
146
|
-
- lib/megam/api/discounts.rb
|
147
142
|
- lib/megam/api/domains.rb
|
148
143
|
- lib/megam/api/errors.rb
|
149
|
-
- lib/megam/api/invoices.rb
|
150
|
-
- lib/megam/api/login.rb
|
151
144
|
- lib/megam/api/marketplaces.rb
|
152
145
|
- lib/megam/api/organizations.rb
|
153
146
|
- lib/megam/api/promos.rb
|
154
147
|
- lib/megam/api/requests.rb
|
155
148
|
- lib/megam/api/sensors.rb
|
156
149
|
- lib/megam/api/sshkeys.rb
|
157
|
-
- lib/megam/api/subscriptions.rb
|
158
150
|
- lib/megam/api/version.rb
|
159
151
|
- lib/megam/core/account.rb
|
160
152
|
- lib/megam/core/assemblies.rb
|
161
153
|
- lib/megam/core/assemblies_collection.rb
|
162
154
|
- lib/megam/core/assembly.rb
|
163
155
|
- lib/megam/core/assembly_collection.rb
|
164
|
-
- lib/megam/core/auth.rb
|
165
|
-
- lib/megam/core/availableunits.rb
|
166
|
-
- lib/megam/core/availableunits_collection.rb
|
167
156
|
- lib/megam/core/balances.rb
|
168
157
|
- lib/megam/core/balances_collection.rb
|
169
158
|
- lib/megam/core/billedhistories.rb
|
170
159
|
- lib/megam/core/billedhistories_collection.rb
|
171
|
-
- lib/megam/core/billings.rb
|
172
|
-
- lib/megam/core/billings_collection.rb
|
173
160
|
- lib/megam/core/components.rb
|
174
161
|
- lib/megam/core/components_collection.rb
|
175
|
-
- lib/megam/core/config.rb
|
176
|
-
- lib/megam/core/credithistories.rb
|
177
|
-
- lib/megam/core/credithistories_collection.rb
|
178
|
-
- lib/megam/core/csar.rb
|
179
|
-
- lib/megam/core/csar_collection.rb
|
180
|
-
- lib/megam/core/discounts.rb
|
181
|
-
- lib/megam/core/discounts_collection.rb
|
182
162
|
- lib/megam/core/domain_collection.rb
|
183
163
|
- lib/megam/core/domains.rb
|
184
164
|
- lib/megam/core/error.rb
|
185
|
-
- lib/megam/core/invoices.rb
|
186
|
-
- lib/megam/core/invoices_collection.rb
|
187
165
|
- lib/megam/core/json_compat.rb
|
188
166
|
- lib/megam/core/konipai.rb
|
189
167
|
- lib/megam/core/log.rb
|
@@ -195,14 +173,12 @@ files:
|
|
195
173
|
- lib/megam/core/promos.rb
|
196
174
|
- lib/megam/core/request.rb
|
197
175
|
- lib/megam/core/request_collection.rb
|
176
|
+
- lib/megam/core/rest_adapter.rb
|
198
177
|
- lib/megam/core/sensors.rb
|
199
178
|
- lib/megam/core/sensors_collection.rb
|
200
|
-
- lib/megam/core/server_api.rb
|
201
179
|
- lib/megam/core/sshkey.rb
|
202
180
|
- lib/megam/core/sshkey_collection.rb
|
203
181
|
- lib/megam/core/stuff.rb
|
204
|
-
- lib/megam/core/subscriptions.rb
|
205
|
-
- lib/megam/core/subscriptions_collection.rb
|
206
182
|
- lib/megam/core/text.rb
|
207
183
|
- lib/megam/core/text_formatter.rb
|
208
184
|
- lib/megam/mixins/assemblies.rb
|
@@ -220,28 +196,17 @@ files:
|
|
220
196
|
- test/test_accounts.rb
|
221
197
|
- test/test_assemblies.rb
|
222
198
|
- test/test_assembly.rb
|
223
|
-
- test/test_availableunits.rb
|
224
199
|
- test/test_balances.rb
|
225
200
|
- test/test_billedhistories.rb
|
226
|
-
- test/test_billings.rb
|
227
|
-
- test/test_cat_requests.rb
|
228
201
|
- test/test_components.rb
|
229
|
-
- test/test_credithistories.rb
|
230
|
-
- test/test_csars.rb
|
231
|
-
- test/test_discounts.rb
|
232
202
|
- test/test_domains.rb
|
233
203
|
- test/test_helper.rb
|
234
|
-
- test/test_invoices.rb
|
235
|
-
- test/test_login.rb
|
236
|
-
- test/test_marketplaceaddons.rb
|
237
204
|
- test/test_marketplaces.rb
|
238
205
|
- test/test_organizations.rb
|
239
|
-
- test/test_predefclouds.rb
|
240
206
|
- test/test_promos.rb
|
241
207
|
- test/test_requests.rb
|
242
208
|
- test/test_sensors.rb
|
243
209
|
- test/test_sshkeys.rb
|
244
|
-
- test/test_subscriptions.rb
|
245
210
|
homepage: http://github.com/megamsys/megam_api
|
246
211
|
licenses:
|
247
212
|
- Apache-2.0
|
@@ -257,9 +222,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
257
222
|
version: '0'
|
258
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
259
224
|
requirements:
|
260
|
-
- - "
|
225
|
+
- - ">"
|
261
226
|
- !ruby/object:Gem::Version
|
262
|
-
version:
|
227
|
+
version: 1.3.1
|
263
228
|
requirements: []
|
264
229
|
rubyforge_project:
|
265
230
|
rubygems_version: 2.5.1
|
@@ -273,25 +238,14 @@ test_files:
|
|
273
238
|
- test/test_accounts.rb
|
274
239
|
- test/test_assemblies.rb
|
275
240
|
- test/test_assembly.rb
|
276
|
-
- test/test_availableunits.rb
|
277
241
|
- test/test_balances.rb
|
278
242
|
- test/test_billedhistories.rb
|
279
|
-
- test/test_billings.rb
|
280
|
-
- test/test_cat_requests.rb
|
281
243
|
- test/test_components.rb
|
282
|
-
- test/test_credithistories.rb
|
283
|
-
- test/test_csars.rb
|
284
|
-
- test/test_discounts.rb
|
285
244
|
- test/test_domains.rb
|
286
245
|
- test/test_helper.rb
|
287
|
-
- test/test_invoices.rb
|
288
|
-
- test/test_login.rb
|
289
|
-
- test/test_marketplaceaddons.rb
|
290
246
|
- test/test_marketplaces.rb
|
291
247
|
- test/test_organizations.rb
|
292
|
-
- test/test_predefclouds.rb
|
293
248
|
- test/test_promos.rb
|
294
249
|
- test/test_requests.rb
|
295
250
|
- test/test_sensors.rb
|
296
251
|
- test/test_sshkeys.rb
|
297
|
-
- test/test_subscriptions.rb
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
-
# License:: Apache License, Version 2.0
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
module Megam
|
17
|
-
class API
|
18
|
-
def get_availableunits
|
19
|
-
@options = {:path => '/availableunits',:body => ""}.merge(@options)
|
20
|
-
|
21
|
-
request(
|
22
|
-
:expects => 200,
|
23
|
-
:method => :get,
|
24
|
-
:body => @options[:body]
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def get_availableunit(id)
|
29
|
-
@options = {:path => "/availableunits/#{id}",:body => ""}.merge(@options)
|
30
|
-
|
31
|
-
request(
|
32
|
-
:expects => 200,
|
33
|
-
:method => :get,
|
34
|
-
:body => @options[:body]
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
def post_availableunits(new_availableunit)
|
39
|
-
@options = {:path => '/availableunits/content',
|
40
|
-
:body => Megam::JSONCompat.to_json(new_availableunit)}.merge(@options)
|
41
|
-
|
42
|
-
request(
|
43
|
-
:expects => 201,
|
44
|
-
:method => :post,
|
45
|
-
:body => @options[:body]
|
46
|
-
)
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
data/lib/megam/api/billings.rb
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
-
# License:: Apache License, Version 2.0
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
module Megam
|
17
|
-
class API
|
18
|
-
def get_billings
|
19
|
-
@options = {:path => '/billings',:body => ""}.merge(@options)
|
20
|
-
|
21
|
-
request(
|
22
|
-
:expects => 200,
|
23
|
-
:method => :get,
|
24
|
-
:body => @options[:body]
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def get_billing(id)
|
29
|
-
@options = {:path => "/billings/#{id}",:body => ""}.merge(@options)
|
30
|
-
|
31
|
-
request(
|
32
|
-
:expects => 200,
|
33
|
-
:method => :get,
|
34
|
-
:body => @options[:body]
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
def post_billings(new_billing)
|
39
|
-
@options = {:path => '/billings/content',
|
40
|
-
:body => Megam::JSONCompat.to_json(new_billing)}.merge(@options)
|
41
|
-
|
42
|
-
request(
|
43
|
-
:expects => 201,
|
44
|
-
:method => :post,
|
45
|
-
:body => @options[:body]
|
46
|
-
)
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
@@ -1,50 +0,0 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
-
# License:: Apache License, Version 2.0
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
module Megam
|
17
|
-
class API
|
18
|
-
def get_credithistories
|
19
|
-
@options = {:path => '/credithistories',:body => ""}.merge(@options)
|
20
|
-
|
21
|
-
request(
|
22
|
-
:expects => 200,
|
23
|
-
:method => :get,
|
24
|
-
:body => @options[:body]
|
25
|
-
)
|
26
|
-
end
|
27
|
-
|
28
|
-
def get_credithistories(id)
|
29
|
-
@options = {:path => "/credithistories/#{id}",:body => ""}.merge(@options)
|
30
|
-
|
31
|
-
request(
|
32
|
-
:expects => 200,
|
33
|
-
:method => :get,
|
34
|
-
:body => @options[:body]
|
35
|
-
)
|
36
|
-
end
|
37
|
-
|
38
|
-
def post_credithistories(new_credithistories)
|
39
|
-
@options = {:path => '/credithistories/content',
|
40
|
-
:body => Megam::JSONCompat.to_json(new_credithistories)}.merge(@options)
|
41
|
-
|
42
|
-
request(
|
43
|
-
:expects => 201,
|
44
|
-
:method => :post,
|
45
|
-
:body => @options[:body]
|
46
|
-
)
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|
50
|
-
end
|
data/lib/megam/api/csars.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
-
# License:: Apache License, Version 2.0
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
module Megam
|
17
|
-
class API
|
18
|
-
|
19
|
-
# GET /csars
|
20
|
-
def get_csars
|
21
|
-
@options = {:path => '/csars',:body => ""}.merge(@options)
|
22
|
-
|
23
|
-
request(
|
24
|
-
:expects => 200,
|
25
|
-
:method => :get,
|
26
|
-
:body => @options[:body]
|
27
|
-
)
|
28
|
-
end
|
29
|
-
|
30
|
-
def get_csar(id)
|
31
|
-
@options = {:path => "/csars/#{id}",:body => ""}.merge(@options)
|
32
|
-
|
33
|
-
request(
|
34
|
-
:expects => 200,
|
35
|
-
:method => :get,
|
36
|
-
:body => @options[:body]
|
37
|
-
)
|
38
|
-
end
|
39
|
-
|
40
|
-
def post_csar(new_csar)
|
41
|
-
@options = {:path => '/csars/content',
|
42
|
-
:body => new_csar}.merge(@options)
|
43
|
-
|
44
|
-
request(
|
45
|
-
:expects => 201,
|
46
|
-
:method => :post,
|
47
|
-
:body => @options[:body]
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
def push_csar(id)
|
52
|
-
@options = {:path => "/csars/push/#{id}",:body => ""}.merge(@options)
|
53
|
-
|
54
|
-
request(
|
55
|
-
:expects => 201,
|
56
|
-
:method => :get,
|
57
|
-
:body => @options[:body]
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
#Yet to be tested
|
62
|
-
# DELETE /marketplacess/:node_id
|
63
|
-
def delete_marketplaceapp(node_id)
|
64
|
-
@options = {:path => '/marketplaces/#{node_id}',
|
65
|
-
:body => ""}.merge(@options)
|
66
|
-
|
67
|
-
request(
|
68
|
-
:expects => 200,
|
69
|
-
:method => :delete,
|
70
|
-
:body => @options[:body]
|
71
|
-
)
|
72
|
-
end
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|