megam_api 0.78 → 0.79
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/megam/api.rb +8 -0
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/components.rb +13 -1
- data/lib/megam/mixins/assemblies.rb +5 -5
- data/lib/megam/mixins/{assemblys.rb → assembly.rb} +2 -2
- data/test/mixins/test_assemblies.rb +4 -4
- data/test/test_assemblies.rb +6 -2
- data/test/test_assembly.rb +2 -2
- data/test/test_components.rb +14 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 265578c80c963c09316bd9815e2e19c3e3973956
|
4
|
+
data.tar.gz: 86c8ba17bb8654c7b970a367240a6554845a58b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db751289790035ab255e2052c491ee09c19c4889f1ac180c6f5de499e52a8f92339726d353c17bdbe61119f28540d5828a84800d1bb05b7d321e50da440cf436
|
7
|
+
data.tar.gz: 33c749e14be9ed9820969076fbb2f07a0db4142cb64608107accc1cc63623199d994600371b9424148f662fcec774a0e3168abfe61e47806a33f9781e087f1ae
|
data/lib/megam/api.rb
CHANGED
@@ -35,6 +35,14 @@ require 'megam/api/subscriptions'
|
|
35
35
|
require 'megam/api/promos'
|
36
36
|
require 'megam/api/invoices'
|
37
37
|
|
38
|
+
require 'megam/mixins/assemblies'
|
39
|
+
require 'megam/mixins/assembly'
|
40
|
+
require 'megam/mixins/common_deployable'
|
41
|
+
require 'megam/mixins/components'
|
42
|
+
require 'megam/mixins/megam_attributes'
|
43
|
+
require 'megam/mixins/outputs'
|
44
|
+
require 'megam/mixins/policies'
|
45
|
+
|
38
46
|
require 'megam/core/server_api'
|
39
47
|
require 'megam/core/config'
|
40
48
|
require 'megam/core/stuff'
|
data/lib/megam/api/version.rb
CHANGED
@@ -22,6 +22,7 @@ module Megam
|
|
22
22
|
@tosca_type = nil
|
23
23
|
@inputs = []
|
24
24
|
@outputs = []
|
25
|
+
@envs = []
|
25
26
|
@artifacts = {}
|
26
27
|
@artifact_type = nil
|
27
28
|
@content = nil
|
@@ -83,6 +84,14 @@ module Megam
|
|
83
84
|
end
|
84
85
|
end
|
85
86
|
|
87
|
+
def envs(arg = [])
|
88
|
+
if arg != []
|
89
|
+
@envs = arg
|
90
|
+
else
|
91
|
+
@envs
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
86
95
|
def artifacts(arg = nil)
|
87
96
|
if !arg.nil?
|
88
97
|
@artifacts = arg
|
@@ -200,6 +209,7 @@ module Megam
|
|
200
209
|
index_hash['tosca_type'] = tosca_type
|
201
210
|
index_hash['inputs'] = inputs
|
202
211
|
index_hash['outputs'] = outputs
|
212
|
+
index_hash['envs'] = envs
|
203
213
|
index_hash['artifacts'] = artifacts
|
204
214
|
index_hash['related_components'] = related_components
|
205
215
|
index_hash['operations'] = operations
|
@@ -222,6 +232,7 @@ module Megam
|
|
222
232
|
'tosca_type' => tosca_type,
|
223
233
|
'inputs' => inputs,
|
224
234
|
'outputs' => outputs,
|
235
|
+
'envs' => envs,
|
225
236
|
'artifacts' => artifacts,
|
226
237
|
'related_components' => related_components,
|
227
238
|
'operations' => operations,
|
@@ -239,7 +250,7 @@ module Megam
|
|
239
250
|
asm.tosca_type(o['tosca_type']) if o.key?('tosca_type')
|
240
251
|
asm.inputs(o['inputs']) if o.key?('inputs')
|
241
252
|
asm.outputs(o['outputs']) if o.key?('outputs')
|
242
|
-
|
253
|
+
asm.envs(o['envs']) if o.key?('envs')
|
243
254
|
ar = o['artifacts']
|
244
255
|
asm.artifacts[:artifact_type] = ar['artifact_type'] if ar && ar.key?('artifact_type')
|
245
256
|
asm.artifacts[:content] = ar['content'] if ar && ar.key?('content')
|
@@ -270,6 +281,7 @@ module Megam
|
|
270
281
|
@tosca_type = o['tosca_type'] if o.key?('tosca_type')
|
271
282
|
@inputs = o['inputs'] if o.key?('inputs')
|
272
283
|
@outputs = o['outputs'] if o.key?('outputs')
|
284
|
+
@envs = o['envs'] if o.key?('envs')
|
273
285
|
@artifacts = o['artifacts'] if o.key?('artifacts')
|
274
286
|
@related_components = o['related_components'] if o.key?('related_components')
|
275
287
|
@operations = o['operations'] if o.key?('operations')
|
@@ -1,16 +1,16 @@
|
|
1
|
-
require File.expand_path("#{File.dirname(__FILE__)}/
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/assembly")
|
2
2
|
|
3
3
|
module Megam
|
4
4
|
class Mixins
|
5
5
|
class Assemblies
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :assembly
|
7
7
|
|
8
8
|
def initialize(params)
|
9
|
-
@
|
9
|
+
@assembly = Assembly.new(params)
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
def to_hash
|
13
|
+
assembly.to_hash
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
@@ -4,7 +4,7 @@ require File.expand_path("#{File.dirname(__FILE__)}/outputs")
|
|
4
4
|
|
5
5
|
module Megam
|
6
6
|
class Mixins
|
7
|
-
class
|
7
|
+
class Assembly
|
8
8
|
attr_reader :components, :policies, :outputs, :mixins
|
9
9
|
|
10
10
|
def initialize(params)
|
@@ -20,7 +20,7 @@ module Megam
|
|
20
20
|
result[:components] = @components if @components
|
21
21
|
result[:outputs] = @outputs.to_array if @outputs
|
22
22
|
result[:policies] = @policies if @policies
|
23
|
-
|
23
|
+
result
|
24
24
|
end
|
25
25
|
|
26
26
|
private
|
@@ -3,15 +3,15 @@
|
|
3
3
|
gem 'minitest' # ensure we are using the gem version
|
4
4
|
require 'minitest/autorun'
|
5
5
|
|
6
|
-
require File.expand_path("#{File.dirname(__FILE__)}/../../lib/megam/mixins/
|
6
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../../lib/megam/mixins/assemblies")
|
7
7
|
class TestMixinsAssemblies < MiniTest::Unit::TestCase
|
8
8
|
|
9
9
|
def test_torpedo
|
10
10
|
## input the torpedo hash
|
11
|
-
tmp_hash = {"utf8"=>"✓", "
|
12
|
-
|
11
|
+
tmp_hash = {"utf8"=>"✓", "mkp_name" => "ubuntu", "cattype":"TORPEDO", "version":"14.04", "assemblyname"=>"biblical", "domain"=>"megambox.com", "ram"=>"896", "cpu"=>"0.5", "SSH_USEOLD_name"=>"tom", "SSH_NEW_name"=>"", "sshoption"=>"SSH_USEOLD", "provider"=>"one", "componentname"=>"ovid", "commit"=>" Create ", "controller"=>"marketplaces", "action"=>"create", "email"=>"8@8.com", "api_key"=>"-NQi-aSKHcmKntCsXb03jw==", "host"=>"192.168.1.105", "org_id"=>"ORG1270367691894554624", "ssh_keypair_name"=>"tom", "name"=>"tom", "path"=>"8@8.com_tom"}
|
12
|
+
assembly_array = Megam::Mixins::Assemblies.new(tmp_hash).to_array
|
13
13
|
puts "=========================================> END <==============================================="
|
14
|
-
puts
|
14
|
+
puts assembly_array.inspect
|
15
15
|
|
16
16
|
#response = megams.post_billings(tmp_hash)
|
17
17
|
#assert_equal(201, response.status)
|
data/test/test_assemblies.rb
CHANGED
@@ -29,11 +29,15 @@ class TestApps < MiniTest::Unit::TestCase
|
|
29
29
|
"status" => "",
|
30
30
|
"related_components" => ["VernonDennis.megam.co"],
|
31
31
|
"outputs" => [],
|
32
|
-
"
|
32
|
+
"envs" => [{
|
33
|
+
"key" => "REDIS_HOST",
|
34
|
+
"value" => "tempp.megambox.com"
|
35
|
+
}],
|
36
|
+
"artifacts" => {
|
33
37
|
"artifact_type" => "tosca_type",
|
34
38
|
"content" => "",
|
35
39
|
"artifact_requirements" => []
|
36
|
-
}
|
40
|
+
},
|
37
41
|
"operations" => [{
|
38
42
|
"operation_type" => "CI",
|
39
43
|
"description" => "continuous Integration",
|
data/test/test_assembly.rb
CHANGED
@@ -4,7 +4,7 @@ class TestApps < MiniTest::Unit::TestCase
|
|
4
4
|
=begin
|
5
5
|
def test_post_assembly
|
6
6
|
tmp_hash = { "name" => "calcines",
|
7
|
-
"components" => ["
|
7
|
+
"components" => ["COM1270769168056188928",""],
|
8
8
|
"tosca_type" => "",
|
9
9
|
"policies" => [{
|
10
10
|
"name" => "bind policy",
|
@@ -24,7 +24,7 @@ class TestApps < MiniTest::Unit::TestCase
|
|
24
24
|
=end
|
25
25
|
#=begin
|
26
26
|
def test_get_assembly
|
27
|
-
response = megams.get_one_assembly("
|
27
|
+
response = megams.get_one_assembly("ASY1271842787775610880")
|
28
28
|
assert_equal(200, response.status)
|
29
29
|
end
|
30
30
|
#=end
|
data/test/test_components.rb
CHANGED
@@ -1,25 +1,36 @@
|
|
1
1
|
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
2
2
|
|
3
3
|
class TestApps < MiniTest::Unit::TestCase
|
4
|
+
#=begin
|
4
5
|
def test_get_component
|
5
|
-
response = megams.get_components("
|
6
|
+
response = megams.get_components("COM1271871641852444672")
|
6
7
|
assert_equal(200, response.status)
|
7
8
|
end
|
9
|
+
#=end
|
8
10
|
=begin
|
9
11
|
def test_update_component
|
10
12
|
tmp_hash = {
|
11
|
-
"id" => "
|
13
|
+
"id" => "COM1271850006541893632",
|
12
14
|
"name" => "NettieMoore",
|
13
15
|
"tosca_type" => "tosca.web.redis",
|
14
16
|
"inputs" => [],
|
15
17
|
"outputs" => [],
|
18
|
+
"envs" => [
|
19
|
+
{
|
20
|
+
"key" => "REDIS_HOST",
|
21
|
+
"value" => "tempp.megambox.com"
|
22
|
+
},
|
23
|
+
],
|
16
24
|
"artifacts" => {
|
17
25
|
"artifact_type" => "tosca type",
|
18
26
|
"content" => "",
|
19
27
|
"artifact_requirements" => []
|
20
28
|
},
|
21
|
-
"related_components" => "AntonioMcCormick.megam.co/TimothyHenderson",
|
29
|
+
"related_components" => ["AntonioMcCormick.megam.co/TimothyHenderson"],
|
22
30
|
"operations" => [],
|
31
|
+
"repo" => {
|
32
|
+
"rtype" => "image", "source" => "github", "oneclick" => "yes", "url" => "imagename"},
|
33
|
+
|
23
34
|
"status" => "",
|
24
35
|
"created_at" => "2014-10-29 14:06:39 +0000"
|
25
36
|
}
|
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: '0.
|
4
|
+
version: '0.79'
|
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: 2015-10-
|
12
|
+
date: 2015-10-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
@@ -208,7 +208,7 @@ files:
|
|
208
208
|
- lib/megam/core/text.rb
|
209
209
|
- lib/megam/core/text_formatter.rb
|
210
210
|
- lib/megam/mixins/assemblies.rb
|
211
|
-
- lib/megam/mixins/
|
211
|
+
- lib/megam/mixins/assembly.rb
|
212
212
|
- lib/megam/mixins/common_deployable.rb
|
213
213
|
- lib/megam/mixins/components.rb
|
214
214
|
- lib/megam/mixins/megam_attributes.rb
|