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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 265578c80c963c09316bd9815e2e19c3e3973956
4
- data.tar.gz: 86c8ba17bb8654c7b970a367240a6554845a58b5
3
+ metadata.gz: c7466e46e439d0da4cf472e1b19dd2841efcd2eb
4
+ data.tar.gz: e9916130b60222949e521bf5d49ad678480b0acf
5
5
  SHA512:
6
- metadata.gz: db751289790035ab255e2052c491ee09c19c4889f1ac180c6f5de499e52a8f92339726d353c17bdbe61119f28540d5828a84800d1bb05b7d321e50da440cf436
7
- data.tar.gz: 33c749e14be9ed9820969076fbb2f07a0db4142cb64608107accc1cc63623199d994600371b9424148f662fcec774a0e3168abfe61e47806a33f9781e087f1ae
6
+ metadata.gz: 2dec71bf5241d1a3311698cf48e15cfbe20c343188993dbb1bcdd003d6a198f3850c4a59f8ec31e30869c70ee389e131277bc711ba1bab3bca630049e3781dac
7
+ data.tar.gz: 07bf76ee7a910c200503f130d86ac87c5aeaa786281a10964f6d4cccc9104308a735485d90d97d66703859274f3b465a3ee07f5189ff9aef3c9087c1d219fc4d
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.79"
3
+ VERSION = "0.81"
4
4
  end
5
5
  end
@@ -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
- @plans= nil
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
- def name(arg=nil)
38
- if arg != nil
37
+ def name(arg = nil)
38
+ if !arg.nil?
39
39
  @name = arg
40
40
  else
41
- @name
41
+ @name
42
42
  end
43
43
  end
44
44
 
45
- def id(arg=nil)
46
- if arg != nil
45
+ def id(arg = nil)
46
+ if !arg.nil?
47
47
  @id = arg
48
48
  else
49
- @id
49
+ @id
50
50
  end
51
51
  end
52
52
 
53
- def plans(arg=nil)
54
- if arg != nil
53
+ def plans(arg = nil)
54
+ if !arg.nil?
55
55
  @plans = arg
56
56
  else
57
- @plans
57
+ @plans
58
58
  end
59
59
  end
60
60
 
61
- def cattype(arg=nil)
62
- if arg != nil
61
+ def cattype(arg = nil)
62
+ if !arg.nil?
63
63
  @cattype = arg
64
64
  else
65
- @cattype
65
+ @cattype
66
66
  end
67
67
  end
68
68
 
69
- def order(arg=nil)
70
- if arg != nil
69
+ def order(arg = nil)
70
+ if !arg.nil?
71
71
  @order = arg
72
72
  else
73
- @order
73
+ @order
74
74
  end
75
75
  end
76
76
 
77
- def image(arg=nil)
78
- if arg != nil
77
+ def image(arg = nil)
78
+ if !arg.nil?
79
79
  @image = arg
80
80
  else
81
- @image
81
+ @image
82
82
  end
83
83
  end
84
84
 
85
- def url(arg=nil)
86
- if arg != nil
85
+ def url(arg = nil)
86
+ if !arg.nil?
87
87
  @url = arg
88
88
  else
89
- @url
89
+ @url
90
90
  end
91
91
  end
92
92
 
93
- def created_at(arg=nil)
94
- if arg != nil
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
- @created_at
106
+ @created_at
98
107
  end
99
108
  end
100
109
 
101
- def some_msg(arg=nil)
102
- if arg != nil
110
+ def some_msg(arg = nil)
111
+ if !arg.nil?
103
112
  @some_msg = arg
104
113
  else
105
- @some_msg
114
+ @some_msg
106
115
  end
107
116
  end
108
117
 
109
118
  def error?
110
- crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
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 = Hash.new
116
- index_hash["json_claz"] = self.class.name
117
- index_hash["id"] = id
118
- index_hash["name"] = name
119
- index_hash["cattype"] = cattype
120
- index_hash["order"] = order
121
- index_hash["image"] = image
122
- index_hash["url"] = url
123
- index_hash["plans"] = plans
124
- index_hash["created_at"] = created_at
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
- "id" => id,
137
- "name" => name,
138
- "cattype" => cattype,
139
- "order" => order,
140
- "image" => image,
141
- "url" => url,
142
- "plans" => plans,
143
- "created_at" => created_at
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["id"]) if o.has_key?("id")
151
- app.name(o["name"]) if o.has_key?("name")
152
- app.cattype(o["cattype"]) if o.has_key?("cattype")
153
- app.order(o["order"]) if o.has_key?("order")
154
- app.image(o["image"]) if o.has_key?("image")
155
- app.url(o["url"]) if o.has_key?("url")
156
- app.plans(o["plans"]) if o.has_key?("plans")
157
- app.created_at(o["created_at"]) if o.has_key?("created_at")
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 = self.new(tmp_email, tmp_api_key, tmp_host)
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["name"] if o.has_key?("name")
170
- @id = o["id"] if o.has_key?("id")
171
- @cattype = o["cattype"] if o.has_key?("cattype")
172
- @order = o["order"] if o.has_key?("order")
173
- @image = o["image"] if o.has_key?("image")
174
- @url = o["url"] if o.has_key?("url")
175
- @plans = o["plans"] if o.has_key?("plans")
176
- @created_at = o["created_at"] if o.has_key?("created_at")
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["email"], params["api_key"], params["host"])
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 = self.new(params["email"], params["api_key"], params["host"])
193
- app.megam_rest.get_marketplaceapp(params["id"])
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 = self.new(params["email"], params["api_key"], params["host"])
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
- #"---> Megam::Account:[error=#{error?}]\n"+
216
+ # "---> Megam::Account:[error=#{error?}]\n"+
204
217
  end
205
-
206
218
  end
207
219
  end
@@ -53,7 +53,7 @@ class TestApps < MiniTest::Unit::TestCase
53
53
  "tosca_type" => "tosca.torpedo.coreos",
54
54
  "inputs" => [{
55
55
  "key" => "Domain",
56
- "value" => "megmbox.com"
56
+ "value" => ""
57
57
  },
58
58
  {
59
59
  "key" => "sshKey",
@@ -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
- =begin
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
- =end
25
- #=begin
24
+ #=end
25
+ =begin
26
26
  def test_get_assembly
27
- response = megams.get_one_assembly("ASY1271842787775610880")
27
+ response = megams.get_one_assembly("ASY1273588307275677696")
28
28
  assert_equal(200, response.status)
29
29
  end
30
- #=end
30
+ =end
31
31
  =begin
32
32
  def test_update_assembly
33
33
  tmp_hash = {
@@ -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("34-Trac")
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.79'
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-10-30 00:00:00.000000000 Z
12
+ date: 2015-11-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: excon