megam_api 0.54 → 0.55
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.rb +2 -2
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/{cat_request.rb → cat_requests.rb} +18 -17
- data/lib/megam/core/{cat_request_collection.rb → cat_requests_collection.rb} +11 -11
- data/lib/megam/core/csar.rb +2 -2
- data/lib/megam/core/json_compat.rb +8 -8
- data/lib/megam/core/marketplace.rb +5 -5
- data/test/test_cat_requests.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 980010a7dfd8098fec9910757c57d05e5fa4b43e
|
4
|
+
data.tar.gz: 5f8d54473a44114d7eedcd1bdb802242db64b753
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50c286965a8f678e9f1ebb4077a7ae38e8b9cd2936f059a4ae8ccfe711706b470ea927560038522da9e0af6a15cc2be90b446e810d93ac5590d239933eb1dcb3
|
7
|
+
data.tar.gz: ff752564eb85dfa060ee057bf82c9680a38d2e3bfffa7c8a79ad4cbc161dc356b015c17462e4e911ec0a0ebb035dab45c7ec725646da002cd7bcb4495e42d3b9
|
data/lib/megam/api.rb
CHANGED
@@ -72,8 +72,8 @@ require "megam/core/assembly"
|
|
72
72
|
require "megam/core/assembly_collection"
|
73
73
|
require "megam/core/components"
|
74
74
|
require "megam/core/components_collection"
|
75
|
-
require "megam/core/
|
76
|
-
require "megam/core/
|
75
|
+
require "megam/core/cat_requests"
|
76
|
+
require "megam/core/cat_requests_collection"
|
77
77
|
require "megam/core/event"
|
78
78
|
|
79
79
|
|
data/lib/megam/api/version.rb
CHANGED
@@ -14,11 +14,12 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
module Megam
|
17
|
-
class
|
17
|
+
class CatRequests < Megam::ServerAPI
|
18
|
+
|
18
19
|
def initialize(email=nil, api_key=nil)
|
19
20
|
@id = nil
|
20
|
-
@
|
21
|
-
@
|
21
|
+
@cat_id = nil
|
22
|
+
@name = nil
|
22
23
|
@action = nil
|
23
24
|
@some_msg = {}
|
24
25
|
@created_at = nil
|
@@ -38,19 +39,19 @@ module Megam
|
|
38
39
|
end
|
39
40
|
end
|
40
41
|
|
41
|
-
def
|
42
|
+
def cat_id(arg=nil)
|
42
43
|
if arg != nil
|
43
|
-
@
|
44
|
+
@cat_id = arg
|
44
45
|
else
|
45
|
-
@
|
46
|
+
@cat_id
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
49
|
-
def
|
50
|
+
def name(arg=nil)
|
50
51
|
if arg != nil
|
51
|
-
@
|
52
|
+
@name = arg
|
52
53
|
else
|
53
|
-
@
|
54
|
+
@name
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
@@ -88,8 +89,8 @@ module Megam
|
|
88
89
|
index_hash = Hash.new
|
89
90
|
index_hash["json_claz"] = self.class.name
|
90
91
|
index_hash["id"] = id
|
91
|
-
index_hash["
|
92
|
-
index_hash["
|
92
|
+
index_hash["cat_id"] = cat_id
|
93
|
+
index_hash["name"] = name
|
93
94
|
index_hash["action"] = action
|
94
95
|
index_hash["created_at"] = created_at
|
95
96
|
index_hash
|
@@ -104,8 +105,8 @@ module Megam
|
|
104
105
|
def for_json
|
105
106
|
result = {
|
106
107
|
"id" => id,
|
107
|
-
"
|
108
|
-
"
|
108
|
+
"cat_id" => cat_id,
|
109
|
+
"name" => name,
|
109
110
|
"action" => action,
|
110
111
|
"created_at" => created_at
|
111
112
|
}
|
@@ -116,8 +117,8 @@ module Megam
|
|
116
117
|
def self.json_create(o)
|
117
118
|
node = new
|
118
119
|
node.id(o["id"]) if o.has_key?("id")
|
119
|
-
node.
|
120
|
-
node.
|
120
|
+
node.cat_id(o["cat_id"]) if o.has_key?("cat_id")
|
121
|
+
node.name(o["name"]) if o.has_key?("name")
|
121
122
|
node.action(o["action"]) if o.has_key?("action")
|
122
123
|
node.created_at(o["created_at"]) if o.has_key?("created_at")
|
123
124
|
#success or error
|
@@ -136,8 +137,8 @@ module Megam
|
|
136
137
|
|
137
138
|
def from_hash(o)
|
138
139
|
@id = o[:id] if o.has_key?(:id)
|
139
|
-
@
|
140
|
-
@
|
140
|
+
@cat_id = o[:cat_id] if o.has_key?(:cat_id)
|
141
|
+
@name = o[:name] if o.has_key?(:name)
|
141
142
|
@action = o[:action] if o.has_key?(:action)
|
142
143
|
@created_at = o[:created_at] if o.has_key?(:created_at)
|
143
144
|
self
|
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
module Megam
|
17
|
-
class
|
17
|
+
class CatRequestsCollection
|
18
18
|
include Enumerable
|
19
19
|
|
20
20
|
attr_reader :iterator
|
@@ -35,14 +35,14 @@ module Megam
|
|
35
35
|
def []=(index, arg)
|
36
36
|
is_megam_request(arg)
|
37
37
|
@catrequests[index] = arg
|
38
|
-
@catrequests_by_name[arg.
|
38
|
+
@catrequests_by_name[arg.cat_id] = index
|
39
39
|
end
|
40
40
|
|
41
41
|
def <<(*args)
|
42
42
|
args.flatten.each do |a|
|
43
43
|
is_megam_request(a)
|
44
44
|
@catrequests << a
|
45
|
-
@catrequests_by_name[a.
|
45
|
+
@catrequests_by_name[a.cat_id] = @catrequests.length - 1
|
46
46
|
end
|
47
47
|
self
|
48
48
|
end
|
@@ -61,11 +61,11 @@ module Megam
|
|
61
61
|
@catrequests_by_name.each_key do |key|
|
62
62
|
@catrequests_by_name[key] += 1 if @catrequests_by_name[key] > @insert_after_idx
|
63
63
|
end
|
64
|
-
@catrequests_by_name[request.
|
64
|
+
@catrequests_by_name[request.cat_id] = @insert_after_idx + 1
|
65
65
|
@insert_after_idx += 1
|
66
66
|
else
|
67
67
|
@catrequests << request
|
68
|
-
@catrequests_by_name[request.
|
68
|
+
@catrequests_by_name[request.cat_id] = @catrequests.length - 1
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
@@ -87,12 +87,12 @@ module Megam
|
|
87
87
|
|
88
88
|
def lookup(request)
|
89
89
|
lookup_by = nil
|
90
|
-
if request.kind_of?(Megam::
|
91
|
-
lookup_by = request.
|
90
|
+
if request.kind_of?(Megam::CatRequests)
|
91
|
+
lookup_by = request.cat_id
|
92
92
|
elsif request.kind_of?(String)
|
93
93
|
lookup_by = request
|
94
94
|
else
|
95
|
-
raise ArgumentError, "Must pass a Megam::
|
95
|
+
raise ArgumentError, "Must pass a Megam::CatRequests or String to lookup"
|
96
96
|
end
|
97
97
|
res = @catrequests_by_name[lookup_by]
|
98
98
|
unless res
|
@@ -105,7 +105,7 @@ module Megam
|
|
105
105
|
def to_hash
|
106
106
|
index_hash = Hash.new
|
107
107
|
self.each do |request|
|
108
|
-
index_hash[request.
|
108
|
+
index_hash[request.cat_id] = request.to_s
|
109
109
|
end
|
110
110
|
index_hash
|
111
111
|
end
|
@@ -131,8 +131,8 @@ module Megam
|
|
131
131
|
private
|
132
132
|
|
133
133
|
def is_megam_request(arg)
|
134
|
-
unless arg.kind_of?(Megam::
|
135
|
-
raise ArgumentError, "Members must be Megam::
|
134
|
+
unless arg.kind_of?(Megam::CatRequests)
|
135
|
+
raise ArgumentError, "Members must be Megam::CatRequests's"
|
136
136
|
end
|
137
137
|
true
|
138
138
|
end
|
data/lib/megam/core/csar.rb
CHANGED
@@ -136,7 +136,7 @@ module Megam
|
|
136
136
|
@id = o["id"] if o.has_key?("id")
|
137
137
|
@desc = o["desc"] if o.has_key?("desc")
|
138
138
|
@link = o["link"] if o.has_key?("link")
|
139
|
-
@yamldata = o["yamldata"] if o.has_key?("yamldata")
|
139
|
+
@yamldata = o["yamldata"] if o.has_key?("yamldata")
|
140
140
|
@created_at = o["created_at"] if o.has_key?("created_at")
|
141
141
|
self
|
142
142
|
end
|
@@ -164,7 +164,7 @@ module Megam
|
|
164
164
|
csarslf = self.new(tmp_email, tmp_api_key)
|
165
165
|
csarslf.megam_rest.get_csars
|
166
166
|
end
|
167
|
-
|
167
|
+
|
168
168
|
#push csar (links)
|
169
169
|
def self.push(tmp_email=nil, tmp_api_key=nil, csar_id)
|
170
170
|
csarslf = self.new(tmp_email, tmp_api_key)
|
@@ -36,8 +36,8 @@ module Megam
|
|
36
36
|
MEGAM_BILLINGHISTORIESCOLLECTION = "Megam::BillinghistoriesCollection".freeze
|
37
37
|
MEGAM_BILLINGS = "Megam::Billings".freeze
|
38
38
|
MEGAM_BILLINGSCOLLECTION = "Megam::BillingsCollection".freeze
|
39
|
-
|
40
|
-
|
39
|
+
MEGAM_CATREQUESTS = "Megam::CatRequests".freeze
|
40
|
+
MEGAM_CATREQUESTSCOLLECTION = "Megam::CatRequestsCollection".freeze
|
41
41
|
MEGAM_CLOUDTOOLSETTING = "Megam::CloudToolSetting".freeze
|
42
42
|
MEGAM_CLOUDTOOLSETTINGCOLLECTION = "Megam::CloudToolSettingCollection".freeze
|
43
43
|
MEGAM_COMPONENTS = "Megam::Components".freeze
|
@@ -66,8 +66,8 @@ module Megam
|
|
66
66
|
MEGAM_SUBSCRIPTIONS = "Megam::Subscriptions".freeze
|
67
67
|
MEGAM_SUBSCRIPTIONSCOLLECTION = "Megam::SubscriptionsCollection".freeze
|
68
68
|
MEGAM_PROMOS = "Megam::Promos".freeze
|
69
|
-
|
70
|
-
|
69
|
+
|
70
|
+
|
71
71
|
class <<self
|
72
72
|
# Increase the max nesting for JSON, which defaults
|
73
73
|
# to 19, and isn't enough for some (for example, a Node within a Node)
|
@@ -192,10 +192,10 @@ module Megam
|
|
192
192
|
Megam::CSARCollection
|
193
193
|
when MEGAM_DOMAIN
|
194
194
|
Megam::Domains
|
195
|
-
when
|
196
|
-
Megam::
|
197
|
-
when
|
198
|
-
Megam::
|
195
|
+
when MEGAM_CATREQUESTS
|
196
|
+
Megam::CatRequests
|
197
|
+
when MEGAM_CATREQUESTSCOLLECTION
|
198
|
+
Megam::CatRequestsCollection
|
199
199
|
when MEGAM_EVENT
|
200
200
|
Megam::Event
|
201
201
|
when MEGAM_AVAILABLEUNITS
|
@@ -153,18 +153,18 @@ module Megam
|
|
153
153
|
app = new
|
154
154
|
app.id(o["id"]) if o.has_key?("id")
|
155
155
|
app.name(o["name"]) if o.has_key?("name")
|
156
|
-
|
156
|
+
|
157
157
|
ct = o["catalog"]
|
158
|
-
app.catalog[:logo] = ct["logo"] if ct && ct.has_key?("logo")
|
158
|
+
app.catalog[:logo] = ct["logo"] if ct && ct.has_key?("logo")
|
159
159
|
app.catalog[:category] = ct["category"] if ct && ct.has_key?("category")
|
160
160
|
app.catalog[:description] = ct["description"] if ct && ct.has_key?("description")
|
161
|
-
|
162
|
-
app.plans(o["plans"]) if o.has_key?("plans")
|
161
|
+
|
162
|
+
app.plans(o["plans"]) if o.has_key?("plans")
|
163
163
|
app.cattype(o["cattype"]) if o.has_key?("cattype")
|
164
164
|
app.predef(o["predef"]) if o.has_key?("predef")
|
165
165
|
app.status(o["status"]) if o.has_key?("status")
|
166
166
|
app.created_at(o["created_at"]) if o.has_key?("created_at")
|
167
|
-
|
167
|
+
|
168
168
|
#success or error
|
169
169
|
app.some_msg[:code] = o["code"] if o.has_key?("code")
|
170
170
|
app.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
data/test/test_cat_requests.rb
CHANGED
@@ -3,8 +3,8 @@ require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
|
3
3
|
class TestApps < MiniTest::Unit::TestCase
|
4
4
|
|
5
5
|
@@tmp_hash = {
|
6
|
-
"
|
7
|
-
"
|
6
|
+
"cat_id" => "ASM1136003656177549312",
|
7
|
+
"name" => "HermanWard.megam.co", #APP or Bolt
|
8
8
|
"action" => "start"
|
9
9
|
}
|
10
10
|
|
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.55'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan
|
@@ -170,8 +170,8 @@ files:
|
|
170
170
|
- lib/megam/core/billinghistories_collection.rb
|
171
171
|
- lib/megam/core/billings.rb
|
172
172
|
- lib/megam/core/billings_collection.rb
|
173
|
-
- lib/megam/core/
|
174
|
-
- lib/megam/core/
|
173
|
+
- lib/megam/core/cat_requests.rb
|
174
|
+
- lib/megam/core/cat_requests_collection.rb
|
175
175
|
- lib/megam/core/cloudtoolsetting.rb
|
176
176
|
- lib/megam/core/cloudtoolsetting_collection.rb
|
177
177
|
- lib/megam/core/components.rb
|