megam_api 0.17 → 0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/lib/megam/api.rb +20 -35
  4. data/lib/megam/api/{nodes.rb → assemblies.rb} +9 -9
  5. data/lib/megam/api/domains.rb +30 -0
  6. data/lib/megam/api/organizations.rb +30 -0
  7. data/lib/megam/api/version.rb +1 -1
  8. data/lib/megam/core/assemblies.rb +180 -0
  9. data/lib/megam/core/{node_collection.rb → assemblies_collection.rb} +44 -65
  10. data/lib/megam/core/csar.rb +0 -1
  11. data/lib/megam/core/domains.rb +129 -0
  12. data/lib/megam/core/json_compat.rb +17 -4
  13. data/lib/megam/core/organizations.rb +129 -0
  14. data/test/test_accounts.rb +1 -1
  15. data/test/test_assemblies.rb +10 -0
  16. data/test/test_domains.rb +27 -0
  17. data/test/test_helper.rb +25 -16
  18. data/test/test_organizations.rb +26 -0
  19. metadata +12 -38
  20. data/lib/megam/api/app_request.rb +0 -27
  21. data/lib/megam/api/appdefns.rb +0 -47
  22. data/lib/megam/api/bolt_request.rb +0 -27
  23. data/lib/megam/api/boltdefns.rb +0 -39
  24. data/lib/megam/api/cloud_tools.rb +0 -35
  25. data/lib/megam/api/logs.rb +0 -18
  26. data/lib/megam/api/predefs.rb +0 -35
  27. data/lib/megam/builder/delete_node.rb +0 -107
  28. data/lib/megam/builder/make_node.rb +0 -133
  29. data/lib/megam/core/app_request.rb +0 -227
  30. data/lib/megam/core/app_request_collection.rb +0 -148
  31. data/lib/megam/core/appdefns.rb +0 -182
  32. data/lib/megam/core/appdefns_collection.rb +0 -148
  33. data/lib/megam/core/bolt_request.rb +0 -225
  34. data/lib/megam/core/bolt_request_collection.rb +0 -148
  35. data/lib/megam/core/boltdefns.rb +0 -207
  36. data/lib/megam/core/boltdefns_collection.rb +0 -148
  37. data/lib/megam/core/cloudinstruction.rb +0 -110
  38. data/lib/megam/core/cloudinstruction_collection.rb +0 -145
  39. data/lib/megam/core/cloudinstruction_group.rb +0 -99
  40. data/lib/megam/core/cloudtemplate.rb +0 -127
  41. data/lib/megam/core/cloudtemplate_collection.rb +0 -145
  42. data/lib/megam/core/cloudtool.rb +0 -152
  43. data/lib/megam/core/cloudtool_collection.rb +0 -145
  44. data/lib/megam/core/node.rb +0 -366
  45. data/lib/megam/core/predef.rb +0 -201
  46. data/lib/megam/core/predef_collection.rb +0 -164
  47. data/test/test_appdefns.rb +0 -35
  48. data/test/test_appreqs.rb +0 -25
  49. data/test/test_boltdefns.rb +0 -32
  50. data/test/test_boltreqs.rb +0 -26
  51. data/test/test_cloudtools.rb +0 -22
  52. data/test/test_nodes.rb +0 -140
  53. data/test/test_predefs.rb +0 -72
@@ -40,7 +40,7 @@ class TestAccounts < MiniTest::Unit::TestCase
40
40
  {:id => random_id, :emailo => sandbox_email,
41
41
  :apik_key => sandbox_apikey, :authority => $admin})
42
42
  response.body.to_s
43
- end
43
+ end
44
44
  end
45
45
  =end
46
46
  end
@@ -0,0 +1,10 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
+
3
+ class TestApps < MiniTest::Unit::TestCase
4
+
5
+
6
+ def test_get_assemblies
7
+ response = megams.get_assemblies("AMS1133263480544165888")
8
+ assert_equal(200, response.status)
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
+
3
+ class TestDomains < 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
+
10
+
11
+ def test_get_domains_good
12
+ response =megams.get_domains(domain_name)
13
+ response.body.to_s
14
+ assert_equal(200, response.status)
15
+ end
16
+
17
+
18
+ def test_post_domains_good
19
+ tmp_hash = {
20
+ "name" => "dmnname"}
21
+
22
+ response =megams.post_domains(tmp_hash)
23
+ response.body.to_s
24
+ assert_equal(201, response.status)
25
+ end
26
+
27
+ end
data/test/test_helper.rb CHANGED
@@ -6,36 +6,38 @@ require 'minitest/autorun'
6
6
  require 'time'
7
7
 
8
8
  SANDBOX_HOST_OPTIONS = {
9
- :scheme => 'https',
10
- :host => 'api.megam.co',
9
+ :scheme => 'http',
10
+ :host => '127.0.0.1',
11
11
  :nonblock => false,
12
- #:port => 9000
13
- :port => 443
12
+ :port => 9000
13
+ #:port => 443
14
14
  }
15
15
 
16
16
 
17
- def megam(options)
17
+ def megam(options)
18
18
  options = SANDBOX_HOST_OPTIONS.merge(options)
19
- mg=Megam::API.new(options)
19
+ mg=Megam::API.new(options)
20
20
  end
21
21
 
22
- def megams_new(options={})
22
+ def megams_new(options={})
23
23
  s_options = SANDBOX_HOST_OPTIONS.merge({
24
24
  :email => "a@b.com",
25
- :api_key => "CSefq53pY3Sv6iBERSjyRQ=="
26
- })
25
+ :api_key => "CSefq53pY3Sv6iBERSjyRQ=="
26
+ })
27
27
  options = s_options.merge(options)
28
- mg=Megam::API.new(options)
28
+ mg=Megam::API.new(options)
29
29
  end
30
30
 
31
- def megams(options={})
31
+
32
+ def megams(options={})
32
33
  s_options = SANDBOX_HOST_OPTIONS.merge({
33
34
  :email => sandbox_email,
34
- :api_key => sandbox_apikey
35
- })
35
+ :api_key => sandbox_apikey
36
+
37
+ })
36
38
  Megam::Log.level(:debug)
37
39
  options = s_options.merge(options)
38
- mg=Megam::API.new(options)
40
+ mg=Megam::API.new(options)
39
41
  end
40
42
 
41
43
  def random_domain
@@ -43,7 +45,7 @@ def random_domain
43
45
  end
44
46
 
45
47
  def random_id
46
- SecureRandom.random_number(1000)
48
+ SecureRandom.random_number(1000)
47
49
  end
48
50
 
49
51
  def random_name
@@ -57,7 +59,14 @@ end
57
59
  def random_email
58
60
  "email@#{random_apikey}.com"
59
61
  end
60
-
62
+
63
+ def domain_name
64
+ "defaultdomain.co"
65
+ end
66
+
67
+ def sandbox_name
68
+ "Default_Org"
69
+ end
61
70
 
62
71
  def sandbox_apikey
63
72
  "IamAtlas{74}NobodyCanSeeME#07"
@@ -0,0 +1,26 @@
1
+ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
+
3
+ class TestOrganizations < 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
+
10
+
11
+ def test_get_organizations_good
12
+ response =megams.get_organizations(sandbox_name)
13
+ response.body.to_s
14
+ assert_equal(200, response.status)
15
+ end
16
+
17
+
18
+ def test_post_organizations_good
19
+ tmp_hash = {
20
+ "name" => "orgname"}
21
+ response =megams.post_organizations(tmp_hash)
22
+ response.body.to_s
23
+ assert_equal(201, response.status)
24
+ end
25
+
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: megam_api
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.17'
4
+ version: '0.18'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kishorekumar Neelamegam, Thomas Alrin, Subash Sethurajan, Rajthilak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-29 00:00:00.000000000 Z
11
+ date: 2014-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -130,48 +130,29 @@ files:
130
130
  - lib/certs/cacert.pem
131
131
  - lib/megam/api.rb
132
132
  - lib/megam/api/accounts.rb
133
- - lib/megam/api/app_request.rb
134
- - lib/megam/api/appdefns.rb
135
- - lib/megam/api/bolt_request.rb
136
- - lib/megam/api/boltdefns.rb
133
+ - lib/megam/api/assemblies.rb
137
134
  - lib/megam/api/cloud_tool_settings.rb
138
- - lib/megam/api/cloud_tools.rb
139
135
  - lib/megam/api/csars.rb
136
+ - lib/megam/api/domains.rb
140
137
  - lib/megam/api/errors.rb
141
138
  - lib/megam/api/login.rb
142
- - lib/megam/api/logs.rb
143
139
  - lib/megam/api/marketplace_addons.rb
144
140
  - lib/megam/api/marketplaces.rb
145
- - lib/megam/api/nodes.rb
141
+ - lib/megam/api/organizations.rb
146
142
  - lib/megam/api/predef_clouds.rb
147
- - lib/megam/api/predefs.rb
148
143
  - lib/megam/api/requests.rb
149
144
  - lib/megam/api/sshkeys.rb
150
145
  - lib/megam/api/version.rb
151
- - lib/megam/builder/delete_node.rb
152
- - lib/megam/builder/make_node.rb
153
146
  - lib/megam/core/account.rb
154
- - lib/megam/core/app_request.rb
155
- - lib/megam/core/app_request_collection.rb
156
- - lib/megam/core/appdefns.rb
157
- - lib/megam/core/appdefns_collection.rb
147
+ - lib/megam/core/assemblies.rb
148
+ - lib/megam/core/assemblies_collection.rb
158
149
  - lib/megam/core/auth.rb
159
- - lib/megam/core/bolt_request.rb
160
- - lib/megam/core/bolt_request_collection.rb
161
- - lib/megam/core/boltdefns.rb
162
- - lib/megam/core/boltdefns_collection.rb
163
- - lib/megam/core/cloudinstruction.rb
164
- - lib/megam/core/cloudinstruction_collection.rb
165
- - lib/megam/core/cloudinstruction_group.rb
166
- - lib/megam/core/cloudtemplate.rb
167
- - lib/megam/core/cloudtemplate_collection.rb
168
- - lib/megam/core/cloudtool.rb
169
- - lib/megam/core/cloudtool_collection.rb
170
150
  - lib/megam/core/cloudtoolsetting.rb
171
151
  - lib/megam/core/cloudtoolsetting_collection.rb
172
152
  - lib/megam/core/config.rb
173
153
  - lib/megam/core/csar.rb
174
154
  - lib/megam/core/csar_collection.rb
155
+ - lib/megam/core/domains.rb
175
156
  - lib/megam/core/error.rb
176
157
  - lib/megam/core/json_compat.rb
177
158
  - lib/megam/core/konipai.rb
@@ -181,10 +162,7 @@ files:
181
162
  - lib/megam/core/marketplace_addon_collection.rb
182
163
  - lib/megam/core/marketplace_collection.rb
183
164
  - lib/megam/core/monologger.rb
184
- - lib/megam/core/node.rb
185
- - lib/megam/core/node_collection.rb
186
- - lib/megam/core/predef.rb
187
- - lib/megam/core/predef_collection.rb
165
+ - lib/megam/core/organizations.rb
188
166
  - lib/megam/core/predefcloud.rb
189
167
  - lib/megam/core/predefcloud_collection.rb
190
168
  - lib/megam/core/request.rb
@@ -198,21 +176,17 @@ files:
198
176
  - lib/megam_api.rb
199
177
  - megam_api.gemspec
200
178
  - test/test_accounts.rb
201
- - test/test_appdefns.rb
202
- - test/test_appreqs.rb
203
- - test/test_boltdefns.rb
204
- - test/test_boltreqs.rb
205
- - test/test_cloudtools.rb
179
+ - test/test_assemblies.rb
206
180
  - test/test_cloudtoolsettings.rb
207
181
  - test/test_csars.rb
182
+ - test/test_domains.rb
208
183
  - test/test_helper.rb
209
184
  - test/test_login.rb
210
185
  - test/test_logs.rb
211
186
  - test/test_marketplaceaddons.rb
212
187
  - test/test_marketplaces.rb
213
- - test/test_nodes.rb
188
+ - test/test_organizations.rb
214
189
  - test/test_predefclouds.rb
215
- - test/test_predefs.rb
216
190
  - test/test_requests.rb
217
191
  - test/test_sshkeys.rb
218
192
  homepage: http://github.com/megamsys/megam_api
@@ -1,27 +0,0 @@
1
- module Megam
2
- class API
3
-
4
- #=begin
5
- def get_appreq(node_name)
6
- @options = {:path => "/appreqs/#{node_name}",:body => ""}.merge(@options)
7
-
8
- request(
9
- :expects => 200,
10
- :method => :get,
11
- :body => @options[:body]
12
- )
13
- end
14
- #=end
15
- def post_appreq(new_appreq)
16
- @options = {:path => '/appreqs/content',
17
- :body => Megam::JSONCompat.to_json(new_appreq)}.merge(@options)
18
-
19
- request(
20
- :expects => 201,
21
- :method => :post,
22
- :body => @options[:body]
23
- )
24
- end
25
-
26
- end
27
- end
@@ -1,47 +0,0 @@
1
- module Megam
2
- class API
3
-
4
- def get_appdefn(node_name)
5
- @options = {:path => "/appdefns/#{node_name}",:body => ""}.merge(@options)
6
-
7
- request(
8
- :expects => 200,
9
- :method => :get,
10
- :body => @options[:body]
11
- )
12
- end
13
-
14
- def get_appdefn(node_name,defn_id)
15
- @options = {:path => "/appdefns/#{node_name}/#{defn_id}",:body => ""}.merge(@options)
16
-
17
- request(
18
- :expects => 200,
19
- :method => :get,
20
- :body => @options[:body]
21
- )
22
- end
23
-
24
- def post_appdefn(new_appdefn)
25
- @options = {:path => '/appdefns/content',
26
- :body => Megam::JSONCompat.to_json(new_appdefn)}.merge(@options)
27
-
28
- request(
29
- :expects => 201,
30
- :method => :post,
31
- :body => @options[:body]
32
- )
33
- end
34
-
35
- def update_appdefn(new_appdefn)
36
- @options = {:path => '/appdefns/update',
37
- :body => Megam::JSONCompat.to_json(new_appdefn)}.merge(@options)
38
-
39
- request(
40
- :expects => 201,
41
- :method => :post,
42
- :body => @options[:body]
43
- )
44
- end
45
-
46
- end
47
- end
@@ -1,27 +0,0 @@
1
- module Megam
2
- class API
3
-
4
-
5
- def get_boltreq(node_name)
6
- @options = {:path => "/boltreqs/#{node_name}",:body => ""}.merge(@options)
7
-
8
- request(
9
- :expects => 200,
10
- :method => :get,
11
- :body => @options[:body]
12
- )
13
- end
14
-
15
- def post_boltreq(new_boltreq)
16
- @options = {:path => '/boltreqs/content',
17
- :body => Megam::JSONCompat.to_json(new_boltreq)}.merge(@options)
18
-
19
- request(
20
- :expects => 201,
21
- :method => :post,
22
- :body => @options[:body]
23
- )
24
- end
25
-
26
- end
27
- end
@@ -1,39 +0,0 @@
1
- module Megam
2
- class API
3
-
4
-
5
- def get_boltdefn(boltdefns_id)
6
- @options = {:path => "/boltdefns/#{boltdefns_id}",:body => ""}.merge(@options)
7
-
8
- request(
9
- :expects => 200,
10
- :method => :get,
11
- :body => @options[:body]
12
- )
13
- end
14
-
15
- def post_boltdefn(new_boltdefn)
16
- @options = {:path => '/boltdefns/content',
17
- :body => Megam::JSONCompat.to_json(new_boltdefn)}.merge(@options)
18
-
19
- request(
20
- :expects => 201,
21
- :method => :post,
22
- :body => @options[:body]
23
- )
24
- end
25
-
26
- def update_boltdefn(new_boltdefn)
27
- @options = {:path => '/boltdefns/update',
28
- :body => Megam::JSONCompat.to_json(new_boltdefn)}.merge(@options)
29
-
30
- request(
31
- :expects => 201,
32
- :method => :post,
33
- :body => @options[:body]
34
- )
35
- end
36
-
37
-
38
- end
39
- end
@@ -1,35 +0,0 @@
1
- module Megam
2
- class API
3
- def get_cloudtools
4
- @options = {:path => '/cloudtools',:body => ""}.merge(@options)
5
-
6
- request(
7
- :expects => 200,
8
- :method => :get,
9
- :body => @options[:body]
10
- )
11
- end
12
-
13
- def get_cloudtool(cloudtool_name)
14
- @options = {:path => "/cloudtools/#{cloudtool_name}",:body => ""}.merge(@options)
15
-
16
- request(
17
- :expects => 200,
18
- :method => :get,
19
- :body => @options[:body]
20
- )
21
- end
22
-
23
- def post_cloudtool(new_cloudtool)
24
- @options = {:path => '/cloudtools/content',
25
- :body => Megam::JSONCompat.to_json(new_cloudtool)}.merge(@options)
26
-
27
- request(
28
- :expects => 201,
29
- :method => :post,
30
- :body => @options[:body]
31
- )
32
- end
33
-
34
- end
35
- end