megam_api 0.79 → 0.81
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/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/marketplace.rb +85 -73
- data/test/test_assemblies.rb +1 -1
- data/test/test_assembly.rb +5 -5
- data/test/test_marketplaces.rb +13 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7466e46e439d0da4cf472e1b19dd2841efcd2eb
|
|
4
|
+
data.tar.gz: e9916130b60222949e521bf5d49ad678480b0acf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2dec71bf5241d1a3311698cf48e15cfbe20c343188993dbb1bcdd003d6a198f3850c4a59f8ec31e30869c70ee389e131277bc711ba1bab3bca630049e3781dac
|
|
7
|
+
data.tar.gz: 07bf76ee7a910c200503f130d86ac87c5aeaa786281a10964f6d4cccc9104308a735485d90d97d66703859274f3b465a3ee07f5189ff9aef3c9087c1d219fc4d
|
data/lib/megam/api/version.rb
CHANGED
|
@@ -17,14 +17,15 @@ require 'hashie'
|
|
|
17
17
|
|
|
18
18
|
module Megam
|
|
19
19
|
class MarketPlace < Megam::ServerAPI
|
|
20
|
-
def initialize(email=nil, api_key=nil, host=nil)
|
|
20
|
+
def initialize(email = nil, api_key = nil, host = nil)
|
|
21
21
|
@id = nil
|
|
22
22
|
@name = nil
|
|
23
23
|
@cattype = nil
|
|
24
24
|
@order = nil
|
|
25
25
|
@image = nil
|
|
26
26
|
@url = nil
|
|
27
|
-
@
|
|
27
|
+
@envs = []
|
|
28
|
+
@plans = nil
|
|
28
29
|
@created_at = nil
|
|
29
30
|
super(email, api_key, host)
|
|
30
31
|
end
|
|
@@ -33,95 +34,104 @@ module Megam
|
|
|
33
34
|
self
|
|
34
35
|
end
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
if arg != nil
|
|
37
|
+
def name(arg = nil)
|
|
38
|
+
if !arg.nil?
|
|
39
39
|
@name = arg
|
|
40
40
|
else
|
|
41
|
-
|
|
41
|
+
@name
|
|
42
42
|
end
|
|
43
43
|
end
|
|
44
44
|
|
|
45
|
-
def id(arg=nil)
|
|
46
|
-
if arg
|
|
45
|
+
def id(arg = nil)
|
|
46
|
+
if !arg.nil?
|
|
47
47
|
@id = arg
|
|
48
48
|
else
|
|
49
|
-
|
|
49
|
+
@id
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
def plans(arg=nil)
|
|
54
|
-
if arg
|
|
53
|
+
def plans(arg = nil)
|
|
54
|
+
if !arg.nil?
|
|
55
55
|
@plans = arg
|
|
56
56
|
else
|
|
57
|
-
|
|
57
|
+
@plans
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
|
|
61
|
-
def cattype(arg=nil)
|
|
62
|
-
if arg
|
|
61
|
+
def cattype(arg = nil)
|
|
62
|
+
if !arg.nil?
|
|
63
63
|
@cattype = arg
|
|
64
64
|
else
|
|
65
|
-
|
|
65
|
+
@cattype
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
|
69
|
-
def order(arg=nil)
|
|
70
|
-
if arg
|
|
69
|
+
def order(arg = nil)
|
|
70
|
+
if !arg.nil?
|
|
71
71
|
@order = arg
|
|
72
72
|
else
|
|
73
|
-
|
|
73
|
+
@order
|
|
74
74
|
end
|
|
75
75
|
end
|
|
76
76
|
|
|
77
|
-
def image(arg=nil)
|
|
78
|
-
if arg
|
|
77
|
+
def image(arg = nil)
|
|
78
|
+
if !arg.nil?
|
|
79
79
|
@image = arg
|
|
80
80
|
else
|
|
81
|
-
|
|
81
|
+
@image
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
def url(arg=nil)
|
|
86
|
-
if arg
|
|
85
|
+
def url(arg = nil)
|
|
86
|
+
if !arg.nil?
|
|
87
87
|
@url = arg
|
|
88
88
|
else
|
|
89
|
-
|
|
89
|
+
@url
|
|
90
90
|
end
|
|
91
91
|
end
|
|
92
92
|
|
|
93
|
-
def
|
|
94
|
-
if arg !=
|
|
93
|
+
def envs(arg = [])
|
|
94
|
+
if arg != []
|
|
95
|
+
@envs = arg
|
|
96
|
+
else
|
|
97
|
+
@envs
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def created_at(arg = nil)
|
|
103
|
+
if !arg.nil?
|
|
95
104
|
@created_at = arg
|
|
96
105
|
else
|
|
97
|
-
|
|
106
|
+
@created_at
|
|
98
107
|
end
|
|
99
108
|
end
|
|
100
109
|
|
|
101
|
-
def some_msg(arg=nil)
|
|
102
|
-
if arg
|
|
110
|
+
def some_msg(arg = nil)
|
|
111
|
+
if !arg.nil?
|
|
103
112
|
@some_msg = arg
|
|
104
113
|
else
|
|
105
|
-
|
|
114
|
+
@some_msg
|
|
106
115
|
end
|
|
107
116
|
end
|
|
108
117
|
|
|
109
118
|
def error?
|
|
110
|
-
crocked
|
|
119
|
+
crocked = true if some_msg.key?(:msg_type) && some_msg[:msg_type] == 'error'
|
|
111
120
|
end
|
|
112
121
|
|
|
113
122
|
# Transform the ruby obj -> to a Hash
|
|
114
123
|
def to_hash
|
|
115
|
-
index_hash =
|
|
116
|
-
index_hash[
|
|
117
|
-
index_hash[
|
|
118
|
-
index_hash[
|
|
119
|
-
index_hash[
|
|
120
|
-
index_hash[
|
|
121
|
-
index_hash[
|
|
122
|
-
index_hash[
|
|
123
|
-
index_hash[
|
|
124
|
-
index_hash[
|
|
124
|
+
index_hash = {}
|
|
125
|
+
index_hash['json_claz'] = self.class.name
|
|
126
|
+
index_hash['id'] = id
|
|
127
|
+
index_hash['name'] = name
|
|
128
|
+
index_hash['cattype'] = cattype
|
|
129
|
+
index_hash['order'] = order
|
|
130
|
+
index_hash['image'] = image
|
|
131
|
+
index_hash['url'] = url
|
|
132
|
+
index_hash['envs'] = envs
|
|
133
|
+
index_hash['plans'] = plans
|
|
134
|
+
index_hash['created_at'] = created_at
|
|
125
135
|
index_hash
|
|
126
136
|
end
|
|
127
137
|
|
|
@@ -133,52 +143,55 @@ module Megam
|
|
|
133
143
|
|
|
134
144
|
def for_json
|
|
135
145
|
result = {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
146
|
+
'id' => id,
|
|
147
|
+
'name' => name,
|
|
148
|
+
'cattype' => cattype,
|
|
149
|
+
'order' => order,
|
|
150
|
+
'image' => image,
|
|
151
|
+
'url' => url,
|
|
152
|
+
'envs' => envs,
|
|
153
|
+
'plans' => plans,
|
|
154
|
+
'created_at' => created_at
|
|
144
155
|
}
|
|
145
156
|
result
|
|
146
157
|
end
|
|
147
158
|
|
|
148
159
|
def self.json_create(o)
|
|
149
160
|
app = new
|
|
150
|
-
app.id(o[
|
|
151
|
-
app.name(o[
|
|
152
|
-
app.cattype(o[
|
|
153
|
-
app.order(o[
|
|
154
|
-
app.image(o[
|
|
155
|
-
app.url(o[
|
|
156
|
-
app.
|
|
157
|
-
app.
|
|
161
|
+
app.id(o['id']) if o.key?('id')
|
|
162
|
+
app.name(o['name']) if o.key?('name')
|
|
163
|
+
app.cattype(o['cattype']) if o.key?('cattype')
|
|
164
|
+
app.order(o['order']) if o.key?('order')
|
|
165
|
+
app.image(o['image']) if o.key?('image')
|
|
166
|
+
app.url(o['url']) if o.key?('url')
|
|
167
|
+
app.envs(o['envs']) if o.key?('envs')
|
|
168
|
+
app.plans(o['plans']) if o.key?('plans')
|
|
169
|
+
app.created_at(o['created_at']) if o.key?('created_at')
|
|
158
170
|
|
|
159
171
|
app
|
|
160
172
|
end
|
|
161
173
|
|
|
162
|
-
def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
|
|
163
|
-
app =
|
|
174
|
+
def self.from_hash(o, tmp_email = nil, tmp_api_key = nil, tmp_host = nil)
|
|
175
|
+
app = new(tmp_email, tmp_api_key, tmp_host)
|
|
164
176
|
app.from_hash(o)
|
|
165
177
|
app
|
|
166
178
|
end
|
|
167
179
|
|
|
168
180
|
def from_hash(o)
|
|
169
|
-
@name = o[
|
|
170
|
-
@id = o[
|
|
171
|
-
@cattype = o[
|
|
172
|
-
@order = o[
|
|
173
|
-
@image = o[
|
|
174
|
-
@url = o[
|
|
175
|
-
@
|
|
176
|
-
@
|
|
181
|
+
@name = o['name'] if o.key?('name')
|
|
182
|
+
@id = o['id'] if o.key?('id')
|
|
183
|
+
@cattype = o['cattype'] if o.key?('cattype')
|
|
184
|
+
@order = o['order'] if o.key?('order')
|
|
185
|
+
@image = o['image'] if o.key?('image')
|
|
186
|
+
@url = o['url'] if o.key?('url')
|
|
187
|
+
@envs = o['envs'] if o.key?('envs')
|
|
188
|
+
@plans = o['plans'] if o.key?('plans')
|
|
189
|
+
@created_at = o['created_at'] if o.key?('created_at')
|
|
177
190
|
self
|
|
178
191
|
end
|
|
179
192
|
|
|
180
193
|
def self.create(params)
|
|
181
|
-
acct = from_hash(params, params[
|
|
194
|
+
acct = from_hash(params, params['email'], params['api_key'], params['host'])
|
|
182
195
|
acct.create
|
|
183
196
|
end
|
|
184
197
|
|
|
@@ -189,19 +202,18 @@ module Megam
|
|
|
189
202
|
|
|
190
203
|
# Load a account by email_p
|
|
191
204
|
def self.show(params)
|
|
192
|
-
app =
|
|
193
|
-
app.megam_rest.get_marketplaceapp(params[
|
|
205
|
+
app = new(params['email'], params['api_key'], params['host'])
|
|
206
|
+
app.megam_rest.get_marketplaceapp(params['id'])
|
|
194
207
|
end
|
|
195
208
|
|
|
196
209
|
def self.list(params)
|
|
197
|
-
app =
|
|
210
|
+
app = new(params['email'], params['api_key'], params['host'])
|
|
198
211
|
app.megam_rest.get_marketplaceapps
|
|
199
212
|
end
|
|
200
213
|
|
|
201
214
|
def to_s
|
|
202
215
|
Megam::Stuff.styled_hash(to_hash)
|
|
203
|
-
|
|
216
|
+
# "---> Megam::Account:[error=#{error?}]\n"+
|
|
204
217
|
end
|
|
205
|
-
|
|
206
218
|
end
|
|
207
219
|
end
|
data/test/test_assemblies.rb
CHANGED
data/test/test_assembly.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
|
2
2
|
|
|
3
3
|
class TestApps < MiniTest::Unit::TestCase
|
|
4
|
-
|
|
4
|
+
#=begin
|
|
5
5
|
def test_post_assembly
|
|
6
6
|
tmp_hash = { "name" => "calcines",
|
|
7
7
|
"components" => ["COM1270769168056188928",""],
|
|
@@ -21,13 +21,13 @@ class TestApps < MiniTest::Unit::TestCase
|
|
|
21
21
|
response = megams.post_assembly(tmp_hash)
|
|
22
22
|
assert_equal(201, response.status)
|
|
23
23
|
end
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
#=end
|
|
25
|
+
=begin
|
|
26
26
|
def test_get_assembly
|
|
27
|
-
response = megams.get_one_assembly("
|
|
27
|
+
response = megams.get_one_assembly("ASY1273588307275677696")
|
|
28
28
|
assert_equal(200, response.status)
|
|
29
29
|
end
|
|
30
|
-
|
|
30
|
+
=end
|
|
31
31
|
=begin
|
|
32
32
|
def test_update_assembly
|
|
33
33
|
tmp_hash = {
|
data/test/test_marketplaces.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
|
2
2
|
|
|
3
3
|
class TestMarketplaces < MiniTest::Unit::TestCase
|
|
4
|
-
|
|
4
|
+
=begin
|
|
5
5
|
def test_post_marketplace
|
|
6
6
|
tmp_hash = {
|
|
7
7
|
"name" => "34-Trac",
|
|
@@ -9,20 +9,28 @@ class TestMarketplaces < MiniTest::Unit::TestCase
|
|
|
9
9
|
"plans" => [{"price"=> "30", "description"=> "description", "plantype"=> "paid", "version"=> "0.1", "source"=> "source"}],
|
|
10
10
|
"cattype" => "DEW",
|
|
11
11
|
"predefnode" => "java",
|
|
12
|
-
"status" => "ACTIVE"
|
|
12
|
+
"status" => "ACTIVE",
|
|
13
|
+
"order" => "",
|
|
14
|
+
"image" => "",
|
|
15
|
+
"url" => "",
|
|
16
|
+
"envs" => []
|
|
17
|
+
}
|
|
13
18
|
|
|
14
19
|
response = megams.post_marketplaceapp(tmp_hash)
|
|
15
20
|
assert_equal(201, response.status)
|
|
16
21
|
end
|
|
22
|
+
=end
|
|
17
23
|
|
|
24
|
+
#=begin
|
|
18
25
|
def test_get_marketplaces
|
|
19
26
|
response = megams.get_marketplaceapps
|
|
20
27
|
assert_equal(200, response.status)
|
|
21
28
|
end
|
|
22
|
-
|
|
29
|
+
#=end
|
|
30
|
+
=begin
|
|
23
31
|
def test_get_marketplace
|
|
24
|
-
response = megams.get_marketplaceapp("
|
|
32
|
+
response = megams.get_marketplaceapp("Mysql")
|
|
25
33
|
assert_equal(200, response.status)
|
|
26
34
|
end
|
|
27
|
-
|
|
35
|
+
=end
|
|
28
36
|
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.81'
|
|
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-
|
|
12
|
+
date: 2015-11-05 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: excon
|