megam_api 0.95 → 0.96

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: 1e8a0f42ca3b125e4c15c17b28b6678fe2283f93
4
- data.tar.gz: fa7609f6ac9427fd2ffe8d117237ebb53fc9671d
3
+ metadata.gz: bf28e37d2d592a57c4ebefeb2a2bccc316da5089
4
+ data.tar.gz: 8ddc56a28e21d535fe1140d76755a876e1c11959
5
5
  SHA512:
6
- metadata.gz: ce7978f9c336ae585c443cd7edc00085a55425727192d9844d2e785ab0992f07efdb6a107903a47c4b433fa3fb42c1d944b0e0f6a0f3154f9e6c461bf89d9a0a
7
- data.tar.gz: 9401e01eef3c64befc83a9a14a4285361870c2afa0c9964b9afafc154be6e24b5005d2e6ca3909a62b047944a609cbad98b9714918d58d40dc6fdea5432fd92c
6
+ metadata.gz: ffb1be4ce1f8e5463e04f13bf67f5894eb05aa2590585c8a46e65cb1ad4e649febaeeb2a2c78eea66e41b28ed390dfc1eb209d78c63543e9ab23cc00574a8964
7
+ data.tar.gz: ac923ced56d8882276ab74d70b2c71c96b15502548ee2710a3f7d4f8f2cf1edb93550d4b1f4be159d2ae2f79efd49706bf966f6ba00c9c64860d058507117a3f
@@ -15,6 +15,6 @@
15
15
  #
16
16
  module Megam
17
17
  class API
18
- VERSION = "0.95"
18
+ VERSION = "0.96"
19
19
  end
20
20
  end
@@ -17,6 +17,7 @@ module Megam
17
17
  class Domains < Megam::ServerAPI
18
18
  def initialize(o)
19
19
  @id = nil
20
+ @org_id = nil
20
21
  @name = nil
21
22
  @created_at = nil
22
23
  super(o)
@@ -33,6 +34,15 @@ module Megam
33
34
  @id
34
35
  end
35
36
  end
37
+
38
+ def org_id(arg=nil)
39
+ if arg != nil
40
+ @org_id = arg
41
+ else
42
+ @org_id
43
+ end
44
+ end
45
+
36
46
 
37
47
  def name(arg=nil)
38
48
  if arg != nil
@@ -54,6 +64,7 @@ module Megam
54
64
  index_hash = Hash.new
55
65
  index_hash["json_claz"] = self.class.name
56
66
  index_hash["id"] = id
67
+ index_hash["org_id"] = org_id
57
68
  index_hash["name"] = name
58
69
  index_hash["created_at"] = created_at
59
70
  index_hash
@@ -66,6 +77,7 @@ module Megam
66
77
  def for_json
67
78
  result = {
68
79
  "id" => id,
80
+ "org_id" => org_id,
69
81
  "name" => name,
70
82
  "created_at" => created_at
71
83
  }
@@ -74,8 +86,9 @@ module Megam
74
86
 
75
87
  # Create a Megam::Domains from JSON (used by the backgroud job workers)
76
88
  def self.json_create(o)
77
- dmn = new
89
+ dmn = new({})
78
90
  dmn.id(o["id"]) if o.has_key?("id")
91
+ dmn.org_id(o["org_id"]) if o.has_key?("org_id")
79
92
  dmn.name(o["name"]) if o.has_key?("name")
80
93
  dmn.created_at(o["created_at"]) if o.has_key?("created_at")
81
94
  dmn
@@ -90,6 +103,7 @@ module Megam
90
103
 
91
104
  def from_hash(o)
92
105
  @id = o[:id] if o.has_key?(:id)
106
+ @org_id = o[:org_id] if o.has_key?(:org_id)
93
107
  @name = o[:name] if o.has_key?(:name)
94
108
  @created_at = o[:created_at] if o.has_key?(:created_at)
95
109
  self
@@ -66,7 +66,7 @@ module Megam
66
66
  if arg != nil
67
67
  @publickey = arg
68
68
  else
69
- @publikey
69
+ @publickey
70
70
  end
71
71
  end
72
72
 
@@ -1,49 +1,29 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestAccounts < MiniTest::Unit::TestCase
4
-
5
- $admin = "admin-tom"
6
- $normal = "normal-tom"
7
- $tom_email = "tom@gomegam.com"
8
- $bob_email = "bob@gomegam.com"
9
- #=begin
10
-
11
- def test_signin_auth
12
- response =megams.get_accounts("test@megam.io")
13
- response.body.to_s
14
- assert_equal(200, response.status)
15
- end
16
-
17
- def test_get_accounts_good
18
- response =megams.get_accounts(sandbox_email)
4
+ def test_signin_auth
5
+ response = megams.get_accounts("test@megam.io")
19
6
  response.body.to_s
20
7
  assert_equal(200, response.status)
21
8
  end
22
9
 
23
-
24
- #=begin
25
-
26
10
  def test_post_accounts_good
27
11
  tmp_hash = {
28
- "id" => "000099090909000",
29
12
  "first_name" => "Darth",
30
13
  "last_name" => "Vader",
31
- "email" => "coolvader@iamswag.com",
14
+ "email" => "test@megam.io",
32
15
  "phone" => "19090909090",
33
16
  "api_key" => "IamAtlas{74}NobdyCanSedfefdeME#07",
34
17
  "authority" => "admin",
35
- "password" => "",
18
+ "password" => Base64.strict_encode64("megam"),
36
19
  "password_reset_key" => "",
37
20
  "password_reset_sent_at" => "",
38
- "created_at" => "2014-10-29 13:24:06 +0000"
39
- }
40
- response =megams.post_accounts(tmp_hash)
21
+ }
22
+ response =megams_new.post_accounts(tmp_hash)
41
23
  response.body.to_s
42
24
  assert_equal(201, response.status)
43
25
  end
44
- #=end
45
26
 
46
- =begin
47
27
  def test_update_accounts_good
48
28
  tmp_hash = {
49
29
  "id" => "w3423",
@@ -52,45 +32,21 @@ end
52
32
  "email" => "super@test.com",
53
33
  "phone" => "19090909090011111111",
54
34
  "api_key" => "IamAtlas{74}NobdyCanSedfefdeME#07",
55
- "authority" => "admin",
56
35
  "password" => "tset",
36
+ "authority" => "admin",
57
37
  "password_reset_key" => "",
58
- "password_reset_sent_at" => "",
59
38
  "created_at" => "2014-10-29 13:24:06 +0000"
60
- }
61
- response = megams.update_accounts(tmp_hash)
62
- response.body.to_s
63
- assert_equal(201, response.status)
64
- end
65
- =end
66
- =begin
67
- def test_get_accounts_bad
68
- assert_raises(Megam::API::Errors::NotFound) do
69
- response =megams.get_accounts(sandbox_email+"_bad")
70
- response.body.to_s
71
- end
72
- end
73
- def test_post_accounts_admin
74
- response =megams.post_accounts(
75
- {:id => random_id, :email => $tom_email, :api_key => sandbox_apikey, :authority => $admin})
76
- response.body.to_s
77
- assert_equal(201, response.status)
78
- end
79
-
80
- def test_post_accounts_normal
81
- response =megams.post_accounts(
82
- {:id => random_id, :email => $bob_email, :api_key => sandbox_apikey, :authority => $normal})
39
+ }
40
+ response = megams.update_accounts(tmp_hash)
83
41
  response.body.to_s
84
42
  assert_equal(201, response.status)
85
43
  end
86
44
 
87
- def test_post_accounts_normal_bad
88
- assert_raises(ArgumentError) do
89
- response =megam.post_accounts(
90
- {:id => random_id, :emailo => sandbox_email,
91
- :apik_key => sandbox_apikey, :authority => $admin})
92
- response.body.to_s
45
+ def test_get_accounts_bad
46
+ assert_raises(Megam::API::Errors::NotFound) do
47
+ response =megams.get_accounts(sandbox_email+"_bad")
48
+ response.body.to_s
93
49
  end
94
50
  end
95
- =end
96
- end
51
+
52
+ end
@@ -1,78 +1,39 @@
1
1
  require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestApps < MiniTest::Unit::TestCase
4
-
5
- #=begin
4
+ #=begin
6
5
  def test_get_assemblies
7
- response = megams.get_assemblies
8
- assert_equal(200, response.status)
9
- end
10
- #=end
11
- #=begin
12
- def test_get_assembly
13
- response = megams.get_one_assemblies("AMS8231283327211460972")
14
- assert_equal(200, response.status)
15
- end
16
- #=end
6
+ response = megams.get_assemblies
7
+ assert_equal(200, response.status)
8
+ end
9
+ #=end
17
10
 
18
- #=begin
19
- def test_post_assembly
20
- tmp_hash = {
21
- "name"=>"",
22
- "org_id"=>"ORG123",
23
- "assemblies"=>[{
24
- "name"=>"covey",
25
- "tosca_type"=>"tosca.app.java",
26
- "inputs"=>[
27
- {"key"=>"domain","value"=>"megambox.com"},
28
- {"key"=>"sshkey","value"=>"a@b.com_rtr"},
29
- {"key"=>"provider","value"=>"one"},
30
- {"key"=>"cpu","value"=>"0.5"},
31
- {"key"=>"ram","value"=>"896"},
32
- {"key"=>"version","value"=>"8.x"},
33
- {"key"=>"lastsuccessstatusupdate","value"=>"02 Feb 16 13:20 IST"},
34
- {"key"=>"status","value"=>"error"}
35
- ],
36
- "outputs"=>[],
37
- "policies"=>[],
38
- "status"=>"error",
39
- "created_at"=>"2016-02-02 07:50:49 +0000",
40
- "components"=>[
41
- {
42
- "name"=>"sheba",
43
- "tosca_type"=>"tosca.app.java",
44
- "inputs"=>[
45
- {"key"=>"domain","value"=>"megambox.com"},
46
- {"key"=>"sshkey","value"=>"a@b.com_rtr"},
47
- {"key"=>"provider","value"=>"one"},
48
- {"key"=>"cpu","value"=>"0.5"},
49
- {"key"=>"ram","value"=>"896"},
50
- {"key"=>"version","value"=>"8.x"},
51
- {"key"=>"lastsuccessstatusupdate","value"=>"02 Feb 16 13:20 IST"},
52
- {"key"=>"status","value"=>"error"}
53
- ],
54
- "outputs"=>[],
55
- "envs"=>[
56
- {"key"=>"port","value"=>"8080"},
57
- {"key"=>"tomcat_username","value"=>"megam"},
58
- {"key"=>"tomcat_password","value"=>"megam"}
59
- ],
60
- "repo"=>{
61
- "rtype"=>"source",
62
- "source"=>"github",
63
- "oneclick"=>"","url"=>"https://github.com/rajthilakmca/java-spring-petclinic.git"
64
- },
65
- "artifacts"=>{"artifact_type"=>"","content"=>"","requirements"=>[]},
66
- "related_components"=>[],
67
- "operations"=>[{
68
- "operation_type"=>"CI",
69
- "description"=>"always up to date code. sweet.",
70
- "properties"=>[
71
- {"key"=>"type","value"=>"github"},
72
- {"key"=>"token","value"=>"066b697558f048459412410483ca8965415bf7de"},
73
- {"key"=>"username","value"=>"rajthilakmca"}],
74
- "status"=>"notbound"}],
75
- "status"=>"error"}]}],
11
+ #=begin
12
+ def test_post_assembly
13
+ tmp_hash = {
14
+ "name"=>"",
15
+ "org_id"=>"ORG123",
16
+ "assemblies"=>[{
17
+ "name"=>"covey",
18
+ "tosca_type"=>"tosca.app.java",
19
+ "inputs"=>[
20
+ {"key"=>"domain","value"=>"megambox.com"},
21
+ {"key"=>"sshkey","value"=>"a@b.com_rtr"},
22
+ {"key"=>"provider","value"=>"one"},
23
+ {"key"=>"cpu","value"=>"0.5"},
24
+ {"key"=>"ram","value"=>"896"},
25
+ {"key"=>"version","value"=>"8.x"},
26
+ {"key"=>"lastsuccessstatusupdate","value"=>"02 Feb 16 13:20 IST"},
27
+ {"key"=>"status","value"=>"error"}
28
+ ],
29
+ "outputs"=>[],
30
+ "policies"=>[],
31
+ "status"=>"error",
32
+ "created_at"=>"2016-02-02 07:50:49 +0000",
33
+ "components"=>[
34
+ {
35
+ "name"=>"sheba",
36
+ "tosca_type"=>"tosca.app.java",
76
37
  "inputs"=>[
77
38
  {"key"=>"domain","value"=>"megambox.com"},
78
39
  {"key"=>"sshkey","value"=>"a@b.com_rtr"},
@@ -81,11 +42,43 @@ class TestApps < MiniTest::Unit::TestCase
81
42
  {"key"=>"ram","value"=>"896"},
82
43
  {"key"=>"version","value"=>"8.x"},
83
44
  {"key"=>"lastsuccessstatusupdate","value"=>"02 Feb 16 13:20 IST"},
84
- {"key"=>"status","value"=>"error"}]
85
- }
45
+ {"key"=>"status","value"=>"error"}
46
+ ],
47
+ "outputs"=>[],
48
+ "envs"=>[
49
+ {"key"=>"port","value"=>"8080"},
50
+ {"key"=>"tomcat_username","value"=>"megam"},
51
+ {"key"=>"tomcat_password","value"=>"megam"}
52
+ ],
53
+ "repo"=>{
54
+ "rtype"=>"source",
55
+ "source"=>"github",
56
+ "oneclick"=>"","url"=>"https://github.com/rajthilakmca/java-spring-petclinic.git"
57
+ },
58
+ "artifacts"=>{"artifact_type"=>"","content"=>"","requirements"=>[]},
59
+ "related_components"=>[],
60
+ "operations"=>[{
61
+ "operation_type"=>"CI",
62
+ "description"=>"always up to date code. sweet.",
63
+ "properties"=>[
64
+ {"key"=>"type","value"=>"github"},
65
+ {"key"=>"token","value"=>"066b697558f048459412410483ca8965415bf7de"},
66
+ {"key"=>"username","value"=>"rajthilakmca"}],
67
+ "status"=>"notbound"}],
68
+ "status"=>"error"}]}],
69
+ "inputs"=>[
70
+ {"key"=>"domain","value"=>"megambox.com"},
71
+ {"key"=>"sshkey","value"=>"a@b.com_rtr"},
72
+ {"key"=>"provider","value"=>"one"},
73
+ {"key"=>"cpu","value"=>"0.5"},
74
+ {"key"=>"ram","value"=>"896"},
75
+ {"key"=>"version","value"=>"8.x"},
76
+ {"key"=>"lastsuccessstatusupdate","value"=>"02 Feb 16 13:20 IST"},
77
+ {"key"=>"status","value"=>"error"}]
78
+ }
86
79
 
87
- response = megams.post_assemblies(tmp_hash)
88
- assert_equal(200, response.status)
89
- end
80
+ response = megams.post_assemblies(tmp_hash)
81
+ assert_equal(200, response.status)
82
+ end
90
83
  #=end
91
84
  end
data/test/test_sshkeys.rb CHANGED
@@ -3,7 +3,6 @@ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
3
3
  class TestApps < MiniTest::Unit::TestCase
4
4
 
5
5
  #=begin
6
-
7
6
  def test_post_sshkey2
8
7
  tmp_hash = {
9
8
  :name => "test_sample",
@@ -43,27 +42,9 @@ txyXl+iiF1+Nco4t/Jj3VvgzoIa25oQp2aeQhY7oot04UyyOYkPkkRQ=
43
42
  #=end
44
43
 
45
44
  #=begin
46
-
47
45
  def test_get_sshkeys
48
46
  response = megams.get_sshkeys
49
47
  assert_equal(200, response.status)
50
48
  end
51
-
52
49
  #=end
53
- =begin
54
-
55
- #=end
56
-
57
- =begin
58
- def test_get_sshkey1
59
- response = megams.get_sshkey("iaas_default")
60
- assert_equal(200, response.status)
61
- end
62
-
63
- def test_get_sshkey_not_found
64
- assert_raises(Megam::API::Errors::NotFound) do
65
- megams.get_sshkey("stupid.megam.co")
66
- end
67
- end
68
- =end
69
50
  end
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.95'
4
+ version: '0.96'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan,