megam_api 0.2.0 → 0.3.0

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: 9757fc9057a94efb7a7aa4ba8ddd78fc70b69fbb
4
- data.tar.gz: ee01e1f309ecc0a567fe1c6e86cf6c615e88a09b
3
+ metadata.gz: bfd6f2f398a4004a3684017e5004213297c55877
4
+ data.tar.gz: 41c5ec1ce6a41eb96b3453b2129dd10b3f636162
5
5
  SHA512:
6
- metadata.gz: 9c53373a37b19b2e57673d92e0c0aa908b7ef18bf0b9747c78979c2c7c4d18d9b53e595fe469cf75d5d4445cf6957a32e033cf1817cd81256e768ff0a1c5d7f7
7
- data.tar.gz: a7e70f0190b2f3624a4f1769c94e2dc3542f1262d7b47cd18342ff7d59ed99c809ae6cf16c1f8d37f55fe1106093d566995d4af4a85b1837951df543f0302330
6
+ metadata.gz: 133f5d530b2f7080c0827b948c2171c3889dbe0ff5ff09d8924b4e74cd6b82c80d593b4d5e8486d535fbef6f412146d295002f49f166516e249736595269b979
7
+ data.tar.gz: 8ed2cced9c93c92420f3b193adddf79ccdadc444764a8bfc8a82d9a0b47c33023435a38f63ca11fc4ea706af934dbf13a2c789cb0d94a044a283cf46e95e315e
@@ -19,8 +19,8 @@ require "megam/api/login"
19
19
  require "megam/api/accounts"
20
20
  require "megam/api/nodes"
21
21
  require "megam/api/appdefns"
22
- require "megam/api/appreqs"
23
- require "megam/api/boltreqs"
22
+ require "megam/api/app_request"
23
+ require "megam/api/bolt_request"
24
24
  require "megam/api/boltdefns"
25
25
  require "megam/api/requests"
26
26
  require "megam/api/predefs"
@@ -35,13 +35,13 @@ require "megam/core/error"
35
35
  require "megam/core/account"
36
36
  require "megam/core/node"
37
37
  require "megam/core/appdefns"
38
- require "megam/core/appreqs"
39
- require "megam/core/boltreqs"
38
+ require "megam/core/app_request"
39
+ require "megam/core/bolt_request"
40
40
  require "megam/core/boltdefns"
41
41
  require "megam/core/node_collection"
42
42
  require "megam/core/appdefns_collection"
43
- require "megam/core/appreqs_collection"
44
- require "megam/core/boltreqs_collection"
43
+ require "megam/core/app_request_collection"
44
+ require "megam/core/bolt_request_collection"
45
45
  require "megam/core/boltdefns_collection"
46
46
  require "megam/core/request"
47
47
  require "megam/core/request_collection"
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module Megam
17
- class Appreqs
17
+ class AppRequest
18
18
  # Each notify entry is a resource/action pair, modeled as an
19
19
  # Struct with a #resource and #action member
20
20
  =begin
@@ -34,8 +34,9 @@ module Megam
34
34
  @lc_additional = nil
35
35
  @lc_when = nil
36
36
  @created_at = nil
37
+ @some_msg = {}
37
38
  end
38
- def node
39
+ def appreq
39
40
  self
40
41
  end
41
42
 
@@ -107,6 +108,13 @@ module Megam
107
108
  @created_at
108
109
  end
109
110
  end
111
+ def some_msg(arg=nil)
112
+ if arg != nil
113
+ @some_msg = arg
114
+ else
115
+ @some_msg
116
+ end
117
+ end
110
118
 
111
119
  def error?
112
120
  crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
@@ -124,6 +132,7 @@ module Megam
124
132
  index_hash["lc_additional"] = lc_additional
125
133
  index_hash["lc_when"] = lc_when
126
134
  index_hash["created_at"] = created_at
135
+ index_hash["some_msg"] = some_msg
127
136
  index_hash
128
137
  end
129
138
 
@@ -168,23 +177,28 @@ module Megam
168
177
  #}]
169
178
  #
170
179
  def self.json_create(o)
171
- node = new
172
- node.id(o["id"]) if o.has_key?("id")
173
- node.req_type(o["req_type"]) if o.has_key?("req_type")
174
- node.appdefns_id(o["appdefns_id"]) if o.has_key?("appdefns_id")
175
- node.node_name(o["node_name"]) if o.has_key?("node_name")
176
- node.lc_apply(o["lc_apply"]) if o.has_key?("lc_apply")
177
- node.lc_additional(o["lc_additional"]) if o.has_key?("lc_additional")
178
- node.lc_when(o["lc_when"]) if o.has_key?("lc_when")
179
- node.created_at(o["created_at"]) if o.has_key?("created_at")
180
+ appreq = new
181
+ appreq.id(o["id"]) if o.has_key?("id")
182
+ appreq.req_type(o["req_type"]) if o.has_key?("req_type")
183
+ appreq.appdefns_id(o["appdefns_id"]) if o.has_key?("appdefns_id")
184
+ appreq.node_name(o["node_name"]) if o.has_key?("node_name")
185
+ appreq.lc_apply(o["lc_apply"]) if o.has_key?("lc_apply")
186
+ appreq.lc_additional(o["lc_additional"]) if o.has_key?("lc_additional")
187
+ appreq.lc_when(o["lc_when"]) if o.has_key?("lc_when")
188
+ appreq.created_at(o["created_at"]) if o.has_key?("created_at")
189
+
190
+ appreq.some_msg[:code] = o["code"] if o.has_key?("code")
191
+ appreq.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
192
+ appreq.some_msg[:msg]= o["msg"] if o.has_key?("msg")
193
+ appreq.some_msg[:links] = o["links"] if o.has_key?("links")
180
194
 
181
- node
195
+ appreq
182
196
  end
183
197
 
184
198
  def self.from_hash(o)
185
- node = self.new()
186
- node.from_hash(o)
187
- node
199
+ appreq = self.new()
200
+ appreq.from_hash(o)
201
+ appreq
188
202
  end
189
203
 
190
204
  def from_hash(o)
@@ -206,13 +220,14 @@ module Megam
206
220
 
207
221
  # Create the node via the REST API
208
222
  def create
209
- megam_rest.post_node(to_hash)
223
+ megam_rest.post_appreq(to_hash)
210
224
  end
211
225
 
212
226
  # Load a account by email_p
213
- def self.show(node_name)
214
- megam_rest.get_node(node_name)
215
- self
227
+ def self.list(node_name)
228
+ appreq = self.new()
229
+ appreq.megam_rest.get_appreq(node_name)
230
+ #self
216
231
  end
217
232
 
218
233
  def to_s
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module Megam
17
- class AppreqsCollection
17
+ class AppRequestCollection
18
18
  include Enumerable
19
19
 
20
20
 
@@ -88,7 +88,7 @@ module Megam
88
88
 
89
89
  def lookup(appreq)
90
90
  lookup_by = nil
91
- if appreq.kind_of?(Megam::Appreqs)
91
+ if appreq.kind_of?(Megam::AppRequest)
92
92
  lookup_by = appreq.id
93
93
  elsif appreq.kind_of?(String)
94
94
  lookup_by = appreq
@@ -134,7 +134,7 @@ module Megam
134
134
 
135
135
 
136
136
  def is_megam_appreq(arg)
137
- unless arg.kind_of?(Megam::Appreqs)
137
+ unless arg.kind_of?(Megam::AppRequest)
138
138
  raise ArgumentError, "Members must be Megam::Appreq's"
139
139
  end
140
140
  true
@@ -31,8 +31,9 @@ module Megam
31
31
  @node_name = nil
32
32
  @appdefns ={}
33
33
  @created_at = nil
34
+ @some_msg = {}
34
35
  end
35
- def node
36
+ def appdefns
36
37
  self
37
38
  end
38
39
 
@@ -82,6 +83,14 @@ module Megam
82
83
  end
83
84
  end
84
85
 
86
+ def some_msg(arg=nil)
87
+ if arg != nil
88
+ @some_msg = arg
89
+ else
90
+ @some_msg
91
+ end
92
+ end
93
+
85
94
  def error?
86
95
  crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
87
96
  end
@@ -97,6 +106,7 @@ puts self.class.name
97
106
  index_hash["node_name"] = node_name
98
107
  index_hash["appdefns"] = appdefns
99
108
  index_hash["created_at"] = created_at
109
+ index_hash["some_msg"] = some_msg
100
110
  index_hash
101
111
  end
102
112
 
@@ -137,25 +147,31 @@ puts self.class.name
137
147
  #}]
138
148
  #
139
149
  def self.json_create(o)
140
- node = new
141
- node.id(o["id"]) if o.has_key?("id")
142
- node.node_id(o["node_id"]) if o.has_key?("node_id")
143
- node.node_name(o["node_name"]) if o.has_key?("node_name")
144
- node.created_at(o["created_at"]) if o.has_key?("created_at")
150
+ appdefns = new
151
+ appdefns.id(o["id"]) if o.has_key?("id")
152
+ appdefns.node_id(o["node_id"]) if o.has_key?("node_id")
153
+ appdefns.node_name(o["node_name"]) if o.has_key?("node_name")
154
+ appdefns.created_at(o["created_at"]) if o.has_key?("created_at")
145
155
 
146
156
  #APP DEFINITIONS
147
157
  op = o["appdefns"]
148
- node.appdefns[:timetokill] = op["timetokill"] if op && op.has_key?("timetokill")
149
- node.appdefns[:metered] = op["metered"] if op && op.has_key?("metered")
150
- node.appdefns[:logging]= op["logging"] if op && op.has_key?("logging")
151
- node.appdefns[:runtime_exec] = op["runtime_exec"] if op && op.has_key?("runtime_exec")
152
- node
158
+ appdefns.appdefns[:timetokill] = op["timetokill"] if op && op.has_key?("timetokill")
159
+ appdefns.appdefns[:metered] = op["metered"] if op && op.has_key?("metered")
160
+ appdefns.appdefns[:logging]= op["logging"] if op && op.has_key?("logging")
161
+ appdefns.appdefns[:runtime_exec] = op["runtime_exec"] if op && op.has_key?("runtime_exec")
162
+
163
+ appdefns.some_msg[:code] = o["code"] if o.has_key?("code")
164
+ appdefns.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
165
+ appdefns.some_msg[:msg]= o["msg"] if o.has_key?("msg")
166
+ appdefns.some_msg[:links] = o["links"] if o.has_key?("links")
167
+
168
+ appdefns
153
169
  end
154
170
 
155
171
  def self.from_hash(o)
156
- node = self.new()
157
- node.from_hash(o)
158
- node
172
+ appdefns = self.new()
173
+ appdefns.from_hash(o)
174
+ appdefns
159
175
  end
160
176
 
161
177
  def from_hash(o)
@@ -179,8 +195,8 @@ puts self.class.name
179
195
 
180
196
  # Load a account by email_p
181
197
  def self.show(node_name)
182
- megam_rest.get_appdefn(node_name)
183
- self
198
+ appdefns = self.new()
199
+ appdefns.megam_rest.get_appdefn(node_name)
184
200
  end
185
201
 
186
202
  def to_s
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module Megam
17
- class Boltreqs
17
+ class BoltRequest
18
18
  # Each notify entry is a resource/action pair, modeled as an
19
19
  # Struct with a #resource and #action member
20
20
  =begin
@@ -34,8 +34,9 @@ module Megam
34
34
  @lc_additional = nil
35
35
  @lc_when = nil
36
36
  @created_at = nil
37
+ @some_msg = {}
37
38
  end
38
- def node
39
+ def boltreqs
39
40
  self
40
41
  end
41
42
 
@@ -107,6 +108,14 @@ module Megam
107
108
  @created_at
108
109
  end
109
110
  end
111
+ def some_msg(arg=nil)
112
+ if arg != nil
113
+ @some_msg = arg
114
+ else
115
+ @some_msg
116
+ end
117
+ end
118
+
110
119
 
111
120
  def error?
112
121
  crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
@@ -124,6 +133,7 @@ module Megam
124
133
  index_hash["lc_additional"] = lc_additional
125
134
  index_hash["lc_when"] = lc_when
126
135
  index_hash["created_at"] = created_at
136
+ index_hash["some_msg"] = some_msg
127
137
  index_hash
128
138
  end
129
139
 
@@ -168,23 +178,28 @@ module Megam
168
178
  #}]
169
179
  #
170
180
  def self.json_create(o)
171
- node = new
172
- node.id(o["id"]) if o.has_key?("id")
173
- node.req_type(o["req_type"]) if o.has_key?("req_type")
174
- node.boltdefns_id(o["boltdefns_id"]) if o.has_key?("boltdefns_id")
175
- node.node_name(o["node_name"]) if o.has_key?("node_name")
176
- node.lc_apply(o["lc_apply"]) if o.has_key?("lc_apply")
177
- node.lc_additional(o["lc_additional"]) if o.has_key?("lc_additional")
178
- node.lc_when(o["lc_when"]) if o.has_key?("lc_when")
179
- node.created_at(o["created_at"]) if o.has_key?("created_at")
181
+ boltreqs = new
182
+ boltreqs.id(o["id"]) if o.has_key?("id")
183
+ boltreqs.req_type(o["req_type"]) if o.has_key?("req_type")
184
+ boltreqs.boltdefns_id(o["boltdefns_id"]) if o.has_key?("boltdefns_id")
185
+ boltreqs.node_name(o["node_name"]) if o.has_key?("node_name")
186
+ boltreqs.lc_apply(o["lc_apply"]) if o.has_key?("lc_apply")
187
+ boltreqs.lc_additional(o["lc_additional"]) if o.has_key?("lc_additional")
188
+ boltreqs.lc_when(o["lc_when"]) if o.has_key?("lc_when")
189
+ boltreqs.created_at(o["created_at"]) if o.has_key?("created_at")
190
+
191
+ boltreqs.some_msg[:code] = o["code"] if o.has_key?("code")
192
+ boltreqs.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
193
+ boltreqs.some_msg[:msg]= o["msg"] if o.has_key?("msg")
194
+ boltreqs.some_msg[:links] = o["links"] if o.has_key?("links")
180
195
 
181
- node
196
+ boltreqs
182
197
  end
183
198
 
184
199
  def self.from_hash(o)
185
- node = self.new()
186
- node.from_hash(o)
187
- node
200
+ boltreqs = self.new()
201
+ boltreqs.from_hash(o)
202
+ boltreqs
188
203
  end
189
204
 
190
205
  def from_hash(o)
@@ -206,13 +221,13 @@ module Megam
206
221
 
207
222
  # Create the node via the REST API
208
223
  def create
209
- megam_rest.post_node(to_hash)
224
+ megam_rest.post_boltreq(to_hash)
210
225
  end
211
226
 
212
227
  # Load a account by email_p
213
- def self.show(node_name)
214
- megam_rest.get_node(node_name)
215
- self
228
+ def self.list(node_name)
229
+ boltreq = self.new()
230
+ boltreq.megam_rest.get_boltreq(node_name)
216
231
  end
217
232
 
218
233
  def to_s
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module Megam
17
- class BoltreqsCollection
17
+ class BoltRequestCollection
18
18
  include Enumerable
19
19
 
20
20
 
@@ -88,7 +88,7 @@ module Megam
88
88
 
89
89
  def lookup(boltreq)
90
90
  lookup_by = nil
91
- if boltreq.kind_of?(Megam::Boltreqs)
91
+ if boltreq.kind_of?(Megam::BoltRequest)
92
92
  lookup_by = boltreq.id
93
93
  elsif boltreq.kind_of?(String)
94
94
  lookup_by = boltreq
@@ -134,7 +134,7 @@ module Megam
134
134
 
135
135
 
136
136
  def is_megam_boltreq(arg)
137
- unless arg.kind_of?(Megam::Boltreqs)
137
+ unless arg.kind_of?(Megam::BoltRequest)
138
138
  raise ArgumentError, "Members must be Megam::Boltreq's"
139
139
  end
140
140
  true
@@ -32,8 +32,9 @@ module Megam
32
32
  @node_name = nil
33
33
  @boltdefns ={}
34
34
  @created_at = nil
35
+ @some_msg = {}
35
36
  end
36
- def node
37
+ def boltdefns
37
38
  self
38
39
  end
39
40
 
@@ -83,6 +84,14 @@ module Megam
83
84
  end
84
85
  end
85
86
 
87
+ def some_msg(arg=nil)
88
+ if arg != nil
89
+ @some_msg = arg
90
+ else
91
+ @some_msg
92
+ end
93
+ end
94
+
86
95
  def error?
87
96
  crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
88
97
  end
@@ -96,6 +105,7 @@ module Megam
96
105
  index_hash["node_name"] = node_name
97
106
  index_hash["boltdefns"] = boltdefns
98
107
  index_hash["created_at"] = created_at
108
+ index_hash["some_msg"] = some_msg
99
109
  index_hash
100
110
  end
101
111
 
@@ -136,32 +146,38 @@ module Megam
136
146
  #}]
137
147
  #
138
148
  def self.json_create(o)
139
- node = new
140
- node.id(o["id"]) if o.has_key?("id")
141
- node.node_id(o["node_id"]) if o.has_key?("node_id")
142
- node.node_name(o["node_name"]) if o.has_key?("node_name")
143
- node.created_at(o["created_at"]) if o.has_key?("created_at")
149
+ boltdefns = new
150
+ boltdefns.id(o["id"]) if o.has_key?("id")
151
+ boltdefns.node_id(o["node_id"]) if o.has_key?("node_id")
152
+ boltdefns.node_name(o["node_name"]) if o.has_key?("node_name")
153
+ boltdefns.created_at(o["created_at"]) if o.has_key?("created_at")
144
154
 
145
155
 
146
156
  #APP DEFINITIONS
147
157
  op = o["boltdefns"]
148
- node.boltdefns[:username] = op["username"] if op && op.has_key?("username")
149
- node.boltdefns[:apikey] = op["apikey"] if op && op.has_key?("apikey")
150
- node.boltdefns[:store_name]= op["store_name"] if op && op.has_key?("store_name")
151
- node.boltdefns[:url] = op["url"] if op && op.has_key?("url")
152
- node.boltdefns[:prime] = op["prime"] if op && op.has_key?("prime")
158
+ boltdefns.boltdefns[:username] = op["username"] if op && op.has_key?("username")
159
+ boltdefns.boltdefns[:apikey] = op["apikey"] if op && op.has_key?("apikey")
160
+ boltdefns.boltdefns[:store_name]= op["store_name"] if op && op.has_key?("store_name")
161
+ boltdefns.boltdefns[:url] = op["url"] if op && op.has_key?("url")
162
+ boltdefns.boltdefns[:prime] = op["prime"] if op && op.has_key?("prime")
153
163
 
154
- node.boltdefns[:timetokill] = op["timetokill"] if op && op.has_key?("timetokill")
155
- node.boltdefns[:metered] = op["metered"] if op && op.has_key?("metered")
156
- node.boltdefns[:logging]= op["logging"] if op && op.has_key?("logging")
157
- node.boltdefns[:runtime_exec] = op["runtime_exec"] if op && op.has_key?("runtime_exec")
158
- node
164
+ boltdefns.boltdefns[:timetokill] = op["timetokill"] if op && op.has_key?("timetokill")
165
+ boltdefns.boltdefns[:metered] = op["metered"] if op && op.has_key?("metered")
166
+ boltdefns.boltdefns[:logging]= op["logging"] if op && op.has_key?("logging")
167
+ boltdefns.boltdefns[:runtime_exec] = op["runtime_exec"] if op && op.has_key?("runtime_exec")
168
+
169
+ boltdefns.some_msg[:code] = o["code"] if o.has_key?("code")
170
+ boltdefns.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
171
+ boltdefns.some_msg[:msg]= o["msg"] if o.has_key?("msg")
172
+ boltdefns.some_msg[:links] = o["links"] if o.has_key?("links")
173
+
174
+ boltdefns
159
175
  end
160
176
 
161
177
  def self.from_hash(o)
162
- node = self.new()
163
- node.from_hash(o)
164
- node
178
+ boltdefns = self.new()
179
+ boltdefns.from_hash(o)
180
+ boltdefns
165
181
  end
166
182
 
167
183
  def from_hash(o)
@@ -185,8 +201,9 @@ module Megam
185
201
 
186
202
  # Load a account by email_p
187
203
  def self.show(node_name)
188
- megam_rest.get_boltdefn(node_name)
189
- self
204
+ boltdefns = self.new()
205
+ boltdefns.megam_rest.get_boltdefn(node_name)
206
+
190
207
  end
191
208
 
192
209
  def to_s
@@ -27,13 +27,13 @@ module Megam
27
27
  MEGAM_ACCOUNT = "Megam::Account".freeze
28
28
  MEGAM_NODE = "Megam::Node".freeze
29
29
  MEGAM_APPDEFNS = "Megam::AppDefns".freeze
30
- MEGAM_APPREQS = "Megam::AppRequest".freeze
31
- MEGAM_BOLTREQS = "Megam::BoltRequest".freeze
30
+ MEGAM_APPREQUEST = "Megam::AppRequest".freeze
31
+ MEGAM_BOLTREQUEST = "Megam::BoltRequest".freeze
32
32
  MEGAM_BOLTDEFNS = "Megam::BoltDefns".freeze
33
33
  MEGAM_NODECOLLECTION = "Megam::NodeCollection".freeze
34
34
  MEGAM_APPDEFNSCOLLECTION = "Megam::AppDefnCollection".freeze
35
- MEGAM_APPREQSCOLLECTION = "Megam::AppRequestCollection".freeze
36
- MEGAM_BOLTREQSCOLLECTION = "Megam::BoltRequestCollection".freeze
35
+ MEGAM_APPREQUESTCOLLECTION = "Megam::AppRequestCollection".freeze
36
+ MEGAM_BOLTREQUESTCOLLECTION = "Megam::BoltRequestCollection".freeze
37
37
  MEGAM_BOLTDEFNSCOLLECTION = "Megam::BoltDefnCollection".freeze
38
38
  MEGAM_REQUEST = "Megam::Request".freeze
39
39
  MEGAM_REQUESTCOLLECTION = "Megam::RequestCollection".freeze
@@ -131,20 +131,20 @@ module Megam
131
131
  Megam::Node
132
132
  when MEGAM_APPDEFNS
133
133
  Megam::Appdefns
134
- when MEGAM_APPREQS
135
- Megam::Appreqs
136
- when MEGAM_BOLTREQS
137
- Megam::Boltreqs
134
+ when MEGAM_APPREQUEST
135
+ Megam::AppRequest
136
+ when MEGAM_BOLTREQUEST
137
+ Megam::BoltRequest
138
138
  when MEGAM_BOLTDEFNS
139
139
  Megam::Boltdefns
140
140
  when MEGAM_NODECOLLECTION
141
141
  Megam::NodeCollection
142
142
  when MEGAM_APPDEFNSCOLLECTION
143
143
  Megam::AppdefnsCollection
144
- when MEGAM_APPREQSCOLLECTION
145
- Megam::AppreqsCollection
146
- when MEGAM_BOLTREQSCOLLECTION
147
- Megam::BoltreqsCollection
144
+ when MEGAM_APPREQUESTCOLLECTION
145
+ Megam::AppRequestCollection
146
+ when MEGAM_BOLTREQUESTCOLLECTION
147
+ Megam::BoltRequestCollection
148
148
  when MEGAM_BOLTDEFNSCOLLECTION
149
149
  Megam::BoltdefnsCollection
150
150
  when MEGAM_REQUEST
@@ -39,6 +39,8 @@ module Megam
39
39
  @some_msg = {}
40
40
  #@command = self.class.hash_tree
41
41
  @command = Hashie::Mash.new
42
+ @appdefnsid = nil
43
+ @boltdefnsid = nil
42
44
  @appdefns = {}
43
45
  @boltdefns = {}
44
46
  @created_at = nil
@@ -147,6 +149,21 @@ module Megam
147
149
  @boltdefns
148
150
  end
149
151
  end
152
+ def appdefnsid(arg=nil)
153
+ if arg != nil
154
+ @appdefnsid = arg
155
+ else
156
+ @appdefnsid
157
+ end
158
+ end
159
+
160
+ def boltdefnsid(arg=nil)
161
+ if arg != nil
162
+ @boltdefnsid = arg
163
+ else
164
+ @boltdefnsid
165
+ end
166
+ end
150
167
 
151
168
  def created_at(arg=nil)
152
169
  if arg != nil
@@ -185,6 +202,8 @@ module Megam
185
202
  index_hash["boltdefns"] = boltdefns
186
203
  index_hash["some_msg"] = some_msg
187
204
  index_hash["noofinstances"] = noofinstances.to_i
205
+ index_hash["appdefnsid"] = appdefnsid
206
+ index_hash["boltdefnsid"] = boltdefnsid
188
207
  index_hash["created_at"] = created_at
189
208
  index_hash
190
209
  end
@@ -207,6 +226,8 @@ module Megam
207
226
  "predefs" => predefs,
208
227
  "appdefns" => appdefns,
209
228
  "boltdefns" => boltdefns,
229
+ "appdefnsid" => appdefnsid,
230
+ "boltdefnsid" => boltdefnsid,
210
231
  "noofinstances" => noofinstances,
211
232
  "created_at" => created_at
212
233
  }
@@ -240,6 +261,8 @@ module Megam
240
261
  node.node_type(o["node_type"]) if o.has_key?("node_type")
241
262
  node.req_type(o["req_type"]) if o.has_key?("req_type")
242
263
  node.status(o["status"]) if o.has_key?("status")
264
+ node.appdefnsid(o["appdefnsid"]) if o.has_key?("appdefnsid")
265
+ node.boltdefnsid(o["boltdefnsid"]) if o.has_key?("boltdefnsid")
243
266
  node.noofinstances(o["noofinstances"]) if o.has_key?("noofinstances")
244
267
  node.created_at(o["created_at"]) if o.has_key?("created_at")
245
268
  #requests
@@ -249,8 +272,6 @@ module Megam
249
272
  node.request[:command] = oq["command"] if oq && oq.has_key?("command")
250
273
 
251
274
  #Command
252
- oc = o["command"]
253
- node.command = node.command(oc) if oc && oc.has_key?("systemprovider")
254
275
  =begin
255
276
  node.command[:systemprovider][:provider][:prov] = oc["systemprovider"]["provider"]["prov"]
256
277
  node.command[:compute][:cctype] = oc["compute"]["cctype"]
@@ -317,6 +338,8 @@ module Megam
317
338
  @predefs = o["predefs"] if o.has_key?("predefs")
318
339
  @appdefns = o["appdefns"] if o.has_key?("appdefns")
319
340
  @boltdefns = o["boltdefns"] if o.has_key?("boltdefns")
341
+ @appdefnsid = o["appdefnsid"] if o.has_key?("appdefnsid")
342
+ @boltdefnsid = o["boltdefnsid"] if o.has_key?("boltdefnsid")
320
343
  @noofinstances = o["noofinstances"] if o.has_key?("noofinstances")
321
344
  @created_at = o["created_at"] if o.has_key?("created_at")
322
345
  self
@@ -165,6 +165,7 @@ module Megam
165
165
  predefcd.access[:ssh_key] = op["ssh_key"] if op && op.has_key?("ssh_key")
166
166
  predefcd.access[:identity_file] = op["identity_file"] if op && op.has_key?("identity_file")
167
167
  predefcd.access[:ssh_user]= op["ssh_user"] if op && op.has_key?("ssh_user")
168
+ predefcd.access[:vault_location]= op["vault_location"] if op && op.has_key?("vault_location")
168
169
  #access
169
170
  # predefcd.ideal(o["ideal"]) if o.has_key?("ideal")
170
171
  # predefcd.performance(o["performance"]) if o.has_key?("performance")
@@ -217,7 +218,6 @@ module Megam
217
218
  def self.show(p_name)
218
219
  pre = self.new()
219
220
  pre.megam_rest.get_predefcloud(p_name)
220
- self
221
221
  end
222
222
 
223
223
  def to_s
@@ -168,12 +168,12 @@ module Megam
168
168
  end
169
169
 
170
170
 
171
- def self.list
171
+ def self.show
172
172
  prede = self.new()
173
173
  prede.megam_rest.get_requests
174
174
  end
175
175
 
176
- def self.show(n_name)
176
+ def self.list(n_name)
177
177
  prede = self.new()
178
178
  prede.megam_rest.get_request(n_name)
179
179
  end
@@ -20,7 +20,7 @@ puts tmp_hash
20
20
  end
21
21
  #=begin
22
22
  def test_get_appreqs
23
- response = megams.get_appreq("black1.megam.co")
23
+ response = megams.get_appreq("oceanographer1.megam.co")
24
24
  assert_equal(200, response.status)
25
25
  end
26
26
  #=end
@@ -20,7 +20,8 @@ class TestApps < MiniTest::Unit::TestCase
20
20
  "access" => {
21
21
  "ssh_key" => "megam_ec2",
22
22
  "identity_file" => "~/.ssh/megam_ec2.pem",
23
- "ssh_user" => "ubuntu"
23
+ "ssh_user" => "ubuntu",
24
+ "vault_location" => "https://s3-ap-southeast-1.amazonaws.com/cloudkeys/sandy@megamsandbox.com/default"
24
25
  }
25
26
  },
26
27
  "cloudtool" => {
@@ -39,7 +40,7 @@ class TestApps < MiniTest::Unit::TestCase
39
40
  "req_type" => "create", #CREATE OR DELETE
40
41
  "noofinstances" => 2, # integer
41
42
  "command" => @com,
42
- "predefs" => {"name" => "rails", "scm" => "https://github.com/temp.git",
43
+ "predefs" => {"name" => "rails", "scm" => "",
43
44
  "db" => "postgres@postgresql1.megam.com/night.megam.co", "war" => "http://s3pub.com/0.1/granny.war", "queue" => "queue@queue1", "runtime_exec" => "sudo start rails"},
44
45
  "appdefns" => {"timetokill" => "0", "metered" => "megam", "logging" => "megam", "runtime_exec" => "runtime_execTOM"},
45
46
  "boltdefns" => {"username" => "tom", "apikey" => "123456", "store_name" => "tom_db", "url" => "", "prime" => "", "timetokill" => "", "metered" => "", "logging" => "", "runtime_exec" => ""},
@@ -55,7 +56,7 @@ class TestApps < MiniTest::Unit::TestCase
55
56
  end
56
57
 
57
58
  #=end
58
- =begin
59
+ #=begin
59
60
  def test_post_node2
60
61
  tmp_hash = {
61
62
  "node_name" => "sundown.megam.co",
@@ -66,7 +67,7 @@ tmp_hash = {
66
67
  response = megams.post_node(tmp_hash)
67
68
  assert_equal(201, response.status)
68
69
  end
69
- =end
70
+ #=end
70
71
  def test_get_nodes
71
72
  response = megams.get_nodes
72
73
 
@@ -115,7 +116,8 @@ end
115
116
  "access" => {
116
117
  "ssh_key" => "megam_ec2",
117
118
  "identity_file" => "~/.ssh/megam_ec2.pem",
118
- "ssh_user" => ""
119
+ "ssh_user" => "",
120
+ "vault_location" => "https://s3-ap-southeast-1.amazonaws.com/cloudkeys/sandy@megamsandbox.com/default"
119
121
  }
120
122
  },
121
123
  "cloudtool" => {
@@ -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_predefcloud1
6
6
  tmp_hash = { :name => "aws_ec2_predef_medium", :spec => {
7
7
  :type_name => "aws-ec2",
@@ -12,7 +12,8 @@ class TestApps < MiniTest::Unit::TestCase
12
12
  :access => {
13
13
  :ssh_key => "megam_ec2",
14
14
  :identity_file => "~/.ssh/megam_ec2.pem",
15
- :ssh_user => "ubuntu"
15
+ :ssh_user => "ubuntu",
16
+ :vault_location => "https://s3-ap-southeast-1.amazonaws.com/cloudkeys/sandy@megamsandbox.com/default"
16
17
  },
17
18
  :ideal => "ror,redis,riak",
18
19
  :performance => "10rpm"
@@ -21,7 +22,7 @@ class TestApps < MiniTest::Unit::TestCase
21
22
  response = megams.post_predefcloud(tmp_hash)
22
23
  assert_equal(201, response.status)
23
24
  end
24
-
25
+ #=end
25
26
  def test_post_predefcloud2
26
27
  tmp_hash = { :name => "rkspce_sundown_play", :spec => {
27
28
  :type_name => "rackspace",
@@ -32,7 +33,8 @@ class TestApps < MiniTest::Unit::TestCase
32
33
  :access => {
33
34
  :ssh_key => "boo_flightssh",
34
35
  :identity_file => "https://boering.dropbox.closedloc/aorc.pem",
35
- :ssh_user => "ubuntu"
36
+ :ssh_user => "ubuntu",
37
+ :vault_location => "https://s3-ap-southeast-1.amazonaws.com/cloudkeys/sandy@megamsandbox.com/default"
36
38
  },
37
39
  :ideal => "play,redis,riak",
38
40
  :performance => "10rpm"
@@ -41,27 +43,28 @@ class TestApps < MiniTest::Unit::TestCase
41
43
  assert_equal(201, response.status)
42
44
  end
43
45
 
44
- #=end
46
+ #=begin
45
47
  def test_get_predefclouds
46
48
  response = megams.get_predefclouds
47
49
  assert_equal(200, response.status)
48
50
  end
51
+ #=end
49
52
 
50
53
  def test_get_predefcloud2
51
- response = megams.get_predefcloud("iaas_default")
54
+ response = megams.get_predefcloud("rkspce_sundown_play")
52
55
  assert_equal(200, response.status)
53
56
  end
54
-
57
+ #=begin
55
58
  def test_get_predefcloud1
56
59
  response = megams.get_predefcloud("iaas_default")
57
60
  assert_equal(200, response.status)
58
61
  end
59
- =begin
62
+
60
63
  def test_get_predefcloud_not_found
61
64
  assert_raises(Megam::API::Errors::NotFound) do
62
65
  megams.get_predefcloud("stupid.megam.co")
63
66
  end
64
67
  end
65
- =end
68
+ #=end
66
69
  end
67
70
 
@@ -2,7 +2,7 @@ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
2
2
 
3
3
  class TestApps < MiniTest::Unit::TestCase
4
4
 
5
- =begin
5
+ #=begin
6
6
  def test_get_requests
7
7
  response = megams.get_requests
8
8
  assert_equal(200, response.status)
@@ -13,14 +13,14 @@ class TestApps < MiniTest::Unit::TestCase
13
13
  response = megams.get_request("faulty")
14
14
  end
15
15
  end
16
-
16
+ #=end
17
17
  def test_get_request_good
18
- response = megams.get_request("morning.megam.co")
18
+ response = megams.get_request("black1.megam.co")
19
19
  assert_equal(200, response.status)
20
20
  end
21
- =end
22
21
 
23
22
 
23
+ #=begin
24
24
  @com = {
25
25
  "systemprovider" => {
26
26
  "provider" => {
@@ -37,7 +37,8 @@ class TestApps < MiniTest::Unit::TestCase
37
37
  "access" => {
38
38
  "ssh_key" => "megam_ec2",
39
39
  "identity_file" => "~/.ssh/megam_ec2.pem",
40
- "ssh_user" => ""
40
+ "ssh_user" => "",
41
+ "vault_location" => "https://s3-ap-southeast-1.amazonaws.com/cloudkeys/sandy@megamsandbox.com/default"
41
42
  }
42
43
  },
43
44
  "cloudtool" => {
@@ -80,6 +81,6 @@ puts @@tmp_hash
80
81
  response = megams.post_request(@@tmp_hash)
81
82
  assert_equal(201, response.status)
82
83
  end
83
-
84
+ #=end
84
85
 
85
86
  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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kishorekumar Neelamegam, Thomas Alrin, Subash Sethurajan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-20 00:00:00.000000000 Z
11
+ date: 2013-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -127,10 +127,10 @@ files:
127
127
  - lib/certs/cacert.pem
128
128
  - lib/megam/api.rb
129
129
  - lib/megam/api/accounts.rb
130
+ - lib/megam/api/app_request.rb
130
131
  - lib/megam/api/appdefns.rb
131
- - lib/megam/api/appreqs.rb
132
+ - lib/megam/api/bolt_request.rb
132
133
  - lib/megam/api/boltdefns.rb
133
- - lib/megam/api/boltreqs.rb
134
134
  - lib/megam/api/cloud_tools.rb
135
135
  - lib/megam/api/errors.rb
136
136
  - lib/megam/api/login.rb
@@ -141,15 +141,15 @@ files:
141
141
  - lib/megam/api/requests.rb
142
142
  - lib/megam/api/version.rb
143
143
  - lib/megam/core/account.rb
144
+ - lib/megam/core/app_request.rb
145
+ - lib/megam/core/app_request_collection.rb
144
146
  - lib/megam/core/appdefns.rb
145
147
  - lib/megam/core/appdefns_collection.rb
146
- - lib/megam/core/appreqs.rb
147
- - lib/megam/core/appreqs_collection.rb
148
148
  - lib/megam/core/auth.rb
149
+ - lib/megam/core/bolt_request.rb
150
+ - lib/megam/core/bolt_request_collection.rb
149
151
  - lib/megam/core/boltdefns.rb
150
152
  - lib/megam/core/boltdefns_collection.rb
151
- - lib/megam/core/boltreqs.rb
152
- - lib/megam/core/boltreqs_collection.rb
153
153
  - lib/megam/core/cloudinstruction.rb
154
154
  - lib/megam/core/cloudinstruction_collection.rb
155
155
  - lib/megam/core/cloudinstruction_group.rb