megam_api 0.75 → 0.77
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 +7 -8
- data/lib/megam/api/discounts.rb +2 -7
- data/lib/megam/api/errors.rb +4 -2
- data/lib/megam/api/sensors.rb +35 -0
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/json_compat.rb +21 -19
- data/lib/megam/core/promos.rb +6 -8
- data/lib/megam/core/request.rb +0 -1
- data/lib/megam/core/sensors.rb +157 -0
- data/lib/megam/core/sensors_collection.rb +143 -0
- data/lib/megam/mixins/assemblies.rb +17 -0
- data/lib/megam/mixins/assemblys.rb +42 -0
- data/lib/megam/mixins/common_deployable.rb +72 -0
- data/lib/megam/mixins/components.rb +85 -0
- data/lib/megam/mixins/megam_attributes.rb +30 -0
- data/lib/megam/mixins/outputs.rb +24 -0
- data/lib/megam/mixins/policies.rb +29 -0
- data/test/mixins/test_assemblies.rb +110 -0
- data/test/mixins/test_assembly.rb +74 -0
- data/test/mixins/test_component.rb +56 -0
- data/test/test_helper.rb +5 -5
- data/test/test_invoices.rb +1 -1
- data/test/test_sensors.rb +50 -0
- metadata +20 -8
- data/lib/megam/api/event.rb +0 -23
- data/lib/megam/core/event.rb +0 -145
- data/test/test_event.rb +0 -21
- data/test/test_logs.rb +0 -15
@@ -0,0 +1,110 @@
|
|
1
|
+
#require File.expand_path("#{File.dirname(__FILE__)}/../test_helper")
|
2
|
+
|
3
|
+
gem 'minitest' # ensure we are using the gem version
|
4
|
+
require 'minitest/autorun'
|
5
|
+
|
6
|
+
require File.expand_path("#{File.dirname(__FILE__)}/../../lib/megam/mixins/assemblys")
|
7
|
+
class TestMixinsAssemblies < MiniTest::Unit::TestCase
|
8
|
+
|
9
|
+
def test_torpedo
|
10
|
+
## input the torpedo hash
|
11
|
+
tmp_hash = {"utf8"=>"✓", "version"=>"14.04","mkp_name" => "ubuntu", "cattype":"TORPEDO", "mkp_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_hash = Megam::Mixins::Assemblys.new(tmp_hash).to_hash
|
13
|
+
puts "=========================================> END <==============================================="
|
14
|
+
puts assembly_hash.inspect
|
15
|
+
|
16
|
+
#response = megams.post_billings(tmp_hash)
|
17
|
+
#assert_equal(201, response.status)
|
18
|
+
end
|
19
|
+
=begin
|
20
|
+
def test_app_starterpack
|
21
|
+
## input the torpedo hash
|
22
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
23
|
+
:line1 => "paypal",
|
24
|
+
:line2 => "#kjbh76",
|
25
|
+
:country_code => "",
|
26
|
+
:postal_code => "",
|
27
|
+
:state => "",
|
28
|
+
:phone => "",
|
29
|
+
:bill_type => ""
|
30
|
+
}
|
31
|
+
|
32
|
+
# comp_dable
|
33
|
+
# compare the results
|
34
|
+
response = megams.post_billings(tmp_hash)
|
35
|
+
assert_equal(201, response.status)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_app_git
|
39
|
+
## input the torpedo hash
|
40
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
41
|
+
:line1 => "paypal",
|
42
|
+
:line2 => "#kjbh76",
|
43
|
+
:country_code => "",
|
44
|
+
:postal_code => "",
|
45
|
+
:state => "",
|
46
|
+
:phone => "",
|
47
|
+
:bill_type => ""
|
48
|
+
}
|
49
|
+
|
50
|
+
# comp_dable
|
51
|
+
# compare the results
|
52
|
+
response = megams.post_billings(tmp_hash)
|
53
|
+
assert_equal(201, response.status)
|
54
|
+
end
|
55
|
+
|
56
|
+
def test_app_oneclick
|
57
|
+
## input the torpedo hash
|
58
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
59
|
+
:line1 => "paypal",
|
60
|
+
:line2 => "#kjbh76",
|
61
|
+
:country_code => "",
|
62
|
+
:postal_code => "",
|
63
|
+
:state => "",
|
64
|
+
:phone => "",
|
65
|
+
:bill_type => ""
|
66
|
+
}
|
67
|
+
|
68
|
+
# comp_dable
|
69
|
+
# compare the results
|
70
|
+
response = megams.post_billings(tmp_hash)
|
71
|
+
assert_equal(201, response.status)
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_service
|
75
|
+
## input the torpedo hash
|
76
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
77
|
+
:line1 => "paypal",
|
78
|
+
:line2 => "#kjbh76",
|
79
|
+
:country_code => "",
|
80
|
+
:postal_code => "",
|
81
|
+
:state => "",
|
82
|
+
:phone => "",
|
83
|
+
:bill_type => ""
|
84
|
+
}
|
85
|
+
|
86
|
+
# comp_dable
|
87
|
+
# compare the results
|
88
|
+
response = megams.post_billings(tmp_hash)
|
89
|
+
assert_equal(201, response.status)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_microservice
|
93
|
+
## input the torpedo hash
|
94
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
95
|
+
:line1 => "paypal",
|
96
|
+
:line2 => "#kjbh76",
|
97
|
+
:country_code => "",
|
98
|
+
:postal_code => "",
|
99
|
+
:state => "",
|
100
|
+
:phone => "",
|
101
|
+
:bill_type => ""
|
102
|
+
}
|
103
|
+
|
104
|
+
# comp_dable
|
105
|
+
# compare the results
|
106
|
+
response = megams.post_billings(tmp_hash)
|
107
|
+
assert_equal(201, response.status)
|
108
|
+
end
|
109
|
+
=end
|
110
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
class TestMixinsAssembly < MiniTest::Unit::TestCase
|
2
|
+
|
3
|
+
def test_torpedo
|
4
|
+
## input the torpedo hash
|
5
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
6
|
+
:line1 => "paypal",
|
7
|
+
:line2 => "#kjbh76",
|
8
|
+
:country_code => "",
|
9
|
+
:postal_code => "",
|
10
|
+
:state => "",
|
11
|
+
:phone => "",
|
12
|
+
:bill_type => ""
|
13
|
+
}
|
14
|
+
|
15
|
+
# comp_dable
|
16
|
+
# compare the results
|
17
|
+
response = megams.post_billings(tmp_hash)
|
18
|
+
assert_equal(201, response.status)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_app
|
22
|
+
## input the torpedo hash
|
23
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
24
|
+
:line1 => "paypal",
|
25
|
+
:line2 => "#kjbh76",
|
26
|
+
:country_code => "",
|
27
|
+
:postal_code => "",
|
28
|
+
:state => "",
|
29
|
+
:phone => "",
|
30
|
+
:bill_type => ""
|
31
|
+
}
|
32
|
+
|
33
|
+
# comp_dable
|
34
|
+
# compare the results
|
35
|
+
response = megams.post_billings(tmp_hash)
|
36
|
+
assert_equal(201, response.status)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_service
|
40
|
+
## input the torpedo hash
|
41
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
42
|
+
:line1 => "paypal",
|
43
|
+
:line2 => "#kjbh76",
|
44
|
+
:country_code => "",
|
45
|
+
:postal_code => "",
|
46
|
+
:state => "",
|
47
|
+
:phone => "",
|
48
|
+
:bill_type => ""
|
49
|
+
}
|
50
|
+
|
51
|
+
# comp_dable
|
52
|
+
# compare the results
|
53
|
+
response = megams.post_billings(tmp_hash)
|
54
|
+
assert_equal(201, response.status)
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_microservice
|
58
|
+
## input the torpedo hash
|
59
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
60
|
+
:line1 => "paypal",
|
61
|
+
:line2 => "#kjbh76",
|
62
|
+
:country_code => "",
|
63
|
+
:postal_code => "",
|
64
|
+
:state => "",
|
65
|
+
:phone => "",
|
66
|
+
:bill_type => ""
|
67
|
+
}
|
68
|
+
|
69
|
+
# comp_dable
|
70
|
+
# compare the results
|
71
|
+
response = megams.post_billings(tmp_hash)
|
72
|
+
assert_equal(201, response.status)
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class TestMixinsComponent < MiniTest::Unit::TestCase
|
2
|
+
|
3
|
+
def test_app
|
4
|
+
## input the torpedo hash
|
5
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
6
|
+
:line1 => "paypal",
|
7
|
+
:line2 => "#kjbh76",
|
8
|
+
:country_code => "",
|
9
|
+
:postal_code => "",
|
10
|
+
:state => "",
|
11
|
+
:phone => "",
|
12
|
+
:bill_type => ""
|
13
|
+
}
|
14
|
+
|
15
|
+
# comp_dable
|
16
|
+
# compare the results
|
17
|
+
response = megams.post_billings(tmp_hash)
|
18
|
+
assert_equal(201, response.status)
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_service
|
22
|
+
## input the torpedo hash
|
23
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
24
|
+
:line1 => "paypal",
|
25
|
+
:line2 => "#kjbh76",
|
26
|
+
:country_code => "",
|
27
|
+
:postal_code => "",
|
28
|
+
:state => "",
|
29
|
+
:phone => "",
|
30
|
+
:bill_type => ""
|
31
|
+
}
|
32
|
+
|
33
|
+
# comp_dable
|
34
|
+
# compare the results
|
35
|
+
response = megams.post_billings(tmp_hash)
|
36
|
+
assert_equal(201, response.status)
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_microservice
|
40
|
+
## input the torpedo hash
|
41
|
+
tmp_hash = { :accounts_id => "ACT93476985797",
|
42
|
+
:line1 => "paypal",
|
43
|
+
:line2 => "#kjbh76",
|
44
|
+
:country_code => "",
|
45
|
+
:postal_code => "",
|
46
|
+
:state => "",
|
47
|
+
:phone => "",
|
48
|
+
:bill_type => ""
|
49
|
+
}
|
50
|
+
|
51
|
+
# comp_dable
|
52
|
+
# compare the results
|
53
|
+
response = megams.post_billings(tmp_hash)
|
54
|
+
assert_equal(201, response.status)
|
55
|
+
end
|
56
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -21,8 +21,8 @@ end
|
|
21
21
|
|
22
22
|
def megams_new(options={})
|
23
23
|
s_options = SANDBOX_HOST_OPTIONS.merge({
|
24
|
-
:email => "
|
25
|
-
:api_key => "
|
24
|
+
:email => "coolvader@iamswag.com",
|
25
|
+
:api_key => "IamAtlas{74}NobdyCanSedfefdeME#07"
|
26
26
|
})
|
27
27
|
options = s_options.merge(options)
|
28
28
|
mg=Megam::API.new(options)
|
@@ -69,11 +69,11 @@ def sandbox_name
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def sandbox_apikey
|
72
|
-
"
|
72
|
+
"mIF3GMz1t-atEeVmtilxSw=="
|
73
73
|
end
|
74
74
|
|
75
75
|
def sandbox_email
|
76
76
|
# "darth@vader.com"
|
77
|
-
|
78
|
-
"rr@e.com"
|
77
|
+
"qwe@qwe.co"
|
78
|
+
#"rr@e.com"
|
79
79
|
end
|
data/test/test_invoices.rb
CHANGED
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
2
|
+
|
3
|
+
class TestApps < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
=begin
|
6
|
+
def test_get_sensors
|
7
|
+
response = megams.get_sensors
|
8
|
+
assert_equal(200, response.status)
|
9
|
+
end
|
10
|
+
=end
|
11
|
+
=begin
|
12
|
+
def test_get_sensor
|
13
|
+
response = megams.get_sensor("SNR1270695834413039616")
|
14
|
+
assert_equal(200, response.status)
|
15
|
+
end
|
16
|
+
=end
|
17
|
+
|
18
|
+
#=begin
|
19
|
+
def test_post_sensors
|
20
|
+
tmp_hash = {
|
21
|
+
|
22
|
+
"sensor_type" => "compute.instance.launch",
|
23
|
+
|
24
|
+
"payload" => {
|
25
|
+
"accounts_id" => "ACT000000111",
|
26
|
+
"assemblies_id" => "ASM000001",
|
27
|
+
"assembly_id" => "AMS0000001",
|
28
|
+
"component_id" => "CMP0000001",
|
29
|
+
"state" => "active",
|
30
|
+
"source" => "one",
|
31
|
+
"node" => "192.168.1.100",
|
32
|
+
"message" => "Periodic billing event",
|
33
|
+
"audit_period_begining" => "2015-10-09:01:01:01",
|
34
|
+
"audit_period_ending" => "2015-10-09:01:10:01",
|
35
|
+
"metrics" => [ {
|
36
|
+
"metric_type" => "delta",
|
37
|
+
"metric_value" => 42,
|
38
|
+
"metric_units" => "hits",
|
39
|
+
"metric_name" => "queries"
|
40
|
+
|
41
|
+
}
|
42
|
+
]
|
43
|
+
}
|
44
|
+
|
45
|
+
}
|
46
|
+
response = megams.post_sensors(tmp_hash)
|
47
|
+
assert_equal(200, response.status)
|
48
|
+
end
|
49
|
+
#=end
|
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.
|
4
|
+
version: '0.77'
|
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-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
@@ -146,7 +146,6 @@ files:
|
|
146
146
|
- lib/megam/api/discounts.rb
|
147
147
|
- lib/megam/api/domains.rb
|
148
148
|
- lib/megam/api/errors.rb
|
149
|
-
- lib/megam/api/event.rb
|
150
149
|
- lib/megam/api/invoices.rb
|
151
150
|
- lib/megam/api/login.rb
|
152
151
|
- lib/megam/api/marketplace_addons.rb
|
@@ -154,6 +153,7 @@ files:
|
|
154
153
|
- lib/megam/api/organizations.rb
|
155
154
|
- lib/megam/api/promos.rb
|
156
155
|
- lib/megam/api/requests.rb
|
156
|
+
- lib/megam/api/sensors.rb
|
157
157
|
- lib/megam/api/sshkeys.rb
|
158
158
|
- lib/megam/api/subscriptions.rb
|
159
159
|
- lib/megam/api/version.rb
|
@@ -182,7 +182,6 @@ files:
|
|
182
182
|
- lib/megam/core/discounts_collection.rb
|
183
183
|
- lib/megam/core/domains.rb
|
184
184
|
- lib/megam/core/error.rb
|
185
|
-
- lib/megam/core/event.rb
|
186
185
|
- lib/megam/core/invoices.rb
|
187
186
|
- lib/megam/core/invoices_collection.rb
|
188
187
|
- lib/megam/core/json_compat.rb
|
@@ -198,6 +197,8 @@ files:
|
|
198
197
|
- lib/megam/core/promos.rb
|
199
198
|
- lib/megam/core/request.rb
|
200
199
|
- lib/megam/core/request_collection.rb
|
200
|
+
- lib/megam/core/sensors.rb
|
201
|
+
- lib/megam/core/sensors_collection.rb
|
201
202
|
- lib/megam/core/server_api.rb
|
202
203
|
- lib/megam/core/sshkey.rb
|
203
204
|
- lib/megam/core/sshkey_collection.rb
|
@@ -206,8 +207,18 @@ files:
|
|
206
207
|
- lib/megam/core/subscriptions_collection.rb
|
207
208
|
- lib/megam/core/text.rb
|
208
209
|
- lib/megam/core/text_formatter.rb
|
210
|
+
- lib/megam/mixins/assemblies.rb
|
211
|
+
- lib/megam/mixins/assemblys.rb
|
212
|
+
- lib/megam/mixins/common_deployable.rb
|
213
|
+
- lib/megam/mixins/components.rb
|
214
|
+
- lib/megam/mixins/megam_attributes.rb
|
215
|
+
- lib/megam/mixins/outputs.rb
|
216
|
+
- lib/megam/mixins/policies.rb
|
209
217
|
- lib/megam_api.rb
|
210
218
|
- megam_api.gemspec
|
219
|
+
- test/mixins/test_assemblies.rb
|
220
|
+
- test/mixins/test_assembly.rb
|
221
|
+
- test/mixins/test_component.rb
|
211
222
|
- test/test_accounts.rb
|
212
223
|
- test/test_assemblies.rb
|
213
224
|
- test/test_assembly.rb
|
@@ -221,17 +232,16 @@ files:
|
|
221
232
|
- test/test_csars.rb
|
222
233
|
- test/test_discounts.rb
|
223
234
|
- test/test_domains.rb
|
224
|
-
- test/test_event.rb
|
225
235
|
- test/test_helper.rb
|
226
236
|
- test/test_invoices.rb
|
227
237
|
- test/test_login.rb
|
228
|
-
- test/test_logs.rb
|
229
238
|
- test/test_marketplaceaddons.rb
|
230
239
|
- test/test_marketplaces.rb
|
231
240
|
- test/test_organizations.rb
|
232
241
|
- test/test_predefclouds.rb
|
233
242
|
- test/test_promos.rb
|
234
243
|
- test/test_requests.rb
|
244
|
+
- test/test_sensors.rb
|
235
245
|
- test/test_sshkeys.rb
|
236
246
|
- test/test_subscriptions.rb
|
237
247
|
homepage: http://github.com/megamsys/megam_api
|
@@ -259,6 +269,9 @@ signing_key:
|
|
259
269
|
specification_version: 4
|
260
270
|
summary: Ruby Client for the Megam
|
261
271
|
test_files:
|
272
|
+
- test/mixins/test_assemblies.rb
|
273
|
+
- test/mixins/test_assembly.rb
|
274
|
+
- test/mixins/test_component.rb
|
262
275
|
- test/test_accounts.rb
|
263
276
|
- test/test_assemblies.rb
|
264
277
|
- test/test_assembly.rb
|
@@ -272,16 +285,15 @@ test_files:
|
|
272
285
|
- test/test_csars.rb
|
273
286
|
- test/test_discounts.rb
|
274
287
|
- test/test_domains.rb
|
275
|
-
- test/test_event.rb
|
276
288
|
- test/test_helper.rb
|
277
289
|
- test/test_invoices.rb
|
278
290
|
- test/test_login.rb
|
279
|
-
- test/test_logs.rb
|
280
291
|
- test/test_marketplaceaddons.rb
|
281
292
|
- test/test_marketplaces.rb
|
282
293
|
- test/test_organizations.rb
|
283
294
|
- test/test_predefclouds.rb
|
284
295
|
- test/test_promos.rb
|
285
296
|
- test/test_requests.rb
|
297
|
+
- test/test_sensors.rb
|
286
298
|
- test/test_sshkeys.rb
|
287
299
|
- test/test_subscriptions.rb
|
data/lib/megam/api/event.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
module Megam
|
2
|
-
class API
|
3
|
-
def get_events
|
4
|
-
|
5
|
-
end
|
6
|
-
|
7
|
-
def post_event(new_event)
|
8
|
-
@options = {:path => '/events/content',
|
9
|
-
:body => Megam::JSONCompat.to_json(new_event)}.merge(@options)
|
10
|
-
|
11
|
-
request(
|
12
|
-
:expects => 201,
|
13
|
-
:method => :post,
|
14
|
-
:body => @options[:body]
|
15
|
-
)
|
16
|
-
|
17
|
-
end
|
18
|
-
|
19
|
-
def delete_event(event)
|
20
|
-
end
|
21
|
-
|
22
|
-
end
|
23
|
-
end
|