megam_api 0.45 → 0.46
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 +3 -6
- data/lib/megam/api/app_requests.rb +2 -2
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/{app_request.rb → cat_request.rb} +3 -3
- data/lib/megam/core/{app_request_collection.rb → cat_request_collection.rb} +24 -24
- data/lib/megam/core/json_compat.rb +48 -48
- 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: 61eb2232a462dbf1262c79227b1169c26241f21d
|
4
|
+
data.tar.gz: a29989ef635219275f8bda5206e315a4c81d0984
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b517941d0dbfb6b57250727db3082f40b9da85737b97f8db191065d59d7db3bd62a938b84070abd01895a8e2e8c310fd485df50f141c9361087598c90cf073e
|
7
|
+
data.tar.gz: 631ba42ec4165ada99d439d58864810507d8d2471531ccb352678af17eddaa7e3257940f6209cc3c5755ac896753ca3f147e97fac4a245c989c99cfc6c64e344
|
data/lib/megam/api.rb
CHANGED
@@ -18,7 +18,7 @@ require "megam/api/version"
|
|
18
18
|
require "megam/api/login"
|
19
19
|
require "megam/api/accounts"
|
20
20
|
require "megam/api/requests"
|
21
|
-
require "megam/api/
|
21
|
+
require "megam/api/cat_requests"
|
22
22
|
require "megam/api/predef_clouds"
|
23
23
|
require "megam/api/cloud_tool_settings"
|
24
24
|
require "megam/api/sshkeys"
|
@@ -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_request"
|
76
|
+
require "megam/core/cat_request_collection"
|
77
77
|
require "megam/core/event"
|
78
78
|
|
79
79
|
require "megam/core/availableunits_collection"
|
@@ -119,9 +119,6 @@ module Megam
|
|
119
119
|
:scheme => 'http'
|
120
120
|
}
|
121
121
|
|
122
|
-
API_VERSION1 = "/v1"
|
123
|
-
|
124
|
-
|
125
122
|
|
126
123
|
def text
|
127
124
|
@text ||= Megam::Text.new(STDOUT, STDERR, STDIN, {})
|
data/lib/megam/api/version.rb
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
module Megam
|
17
|
-
class
|
17
|
+
class CatRequest < Megam::ServerAPI
|
18
18
|
def initialize(email=nil, api_key=nil)
|
19
19
|
@id = nil
|
20
20
|
@app_id = nil
|
@@ -25,7 +25,7 @@ module Megam
|
|
25
25
|
super(email, api_key)
|
26
26
|
end
|
27
27
|
|
28
|
-
def
|
28
|
+
def cat_request
|
29
29
|
self
|
30
30
|
end
|
31
31
|
|
@@ -151,7 +151,7 @@ module Megam
|
|
151
151
|
|
152
152
|
# Create the node via the REST API
|
153
153
|
def create
|
154
|
-
megam_rest.
|
154
|
+
megam_rest.post_catrequest(to_hash)
|
155
155
|
end
|
156
156
|
|
157
157
|
|
@@ -14,35 +14,35 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
module Megam
|
17
|
-
class
|
17
|
+
class CatRequestCollection
|
18
18
|
include Enumerable
|
19
19
|
|
20
20
|
attr_reader :iterator
|
21
21
|
def initialize
|
22
|
-
@
|
23
|
-
@
|
22
|
+
@catrequests = Array.new
|
23
|
+
@catrequests_by_name = Hash.new
|
24
24
|
@insert_after_idx = nil
|
25
25
|
end
|
26
26
|
|
27
27
|
def all_requests
|
28
|
-
@
|
28
|
+
@catrequests
|
29
29
|
end
|
30
30
|
|
31
31
|
def [](index)
|
32
|
-
@
|
32
|
+
@catrequests[index]
|
33
33
|
end
|
34
34
|
|
35
35
|
def []=(index, arg)
|
36
36
|
is_megam_request(arg)
|
37
|
-
@
|
38
|
-
@
|
37
|
+
@catrequests[index] = arg
|
38
|
+
@catrequests_by_name[arg.app_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
|
-
@
|
45
|
-
@
|
44
|
+
@catrequests << a
|
45
|
+
@catrequests_by_name[a.app_id] = @catrequests.length - 1
|
46
46
|
end
|
47
47
|
self
|
48
48
|
end
|
@@ -56,49 +56,49 @@ module Megam
|
|
56
56
|
# in the middle of executing a run, so any requests inserted now should
|
57
57
|
# be placed after the most recent addition done by the currently executing
|
58
58
|
# request
|
59
|
-
@
|
59
|
+
@catrequests.insert(@insert_after_idx + 1, request)
|
60
60
|
# update name -> location mappings and register new request
|
61
|
-
@
|
62
|
-
@
|
61
|
+
@catrequests_by_name.each_key do |key|
|
62
|
+
@catrequests_by_name[key] += 1 if @catrequests_by_name[key] > @insert_after_idx
|
63
63
|
end
|
64
|
-
@
|
64
|
+
@catrequests_by_name[request.app_id] = @insert_after_idx + 1
|
65
65
|
@insert_after_idx += 1
|
66
66
|
else
|
67
|
-
@
|
68
|
-
@
|
67
|
+
@catrequests << request
|
68
|
+
@catrequests_by_name[request.app_id] = @catrequests.length - 1
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
72
|
def each
|
73
|
-
@
|
73
|
+
@catrequests.each do |request|
|
74
74
|
yield request
|
75
75
|
end
|
76
76
|
end
|
77
77
|
|
78
78
|
def each_index
|
79
|
-
@
|
79
|
+
@catrequests.each_index do |i|
|
80
80
|
yield i
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
def empty?
|
85
|
-
@
|
85
|
+
@catrequests.empty?
|
86
86
|
end
|
87
87
|
|
88
88
|
def lookup(request)
|
89
89
|
lookup_by = nil
|
90
|
-
if request.kind_of?(Megam::
|
90
|
+
if request.kind_of?(Megam::CatRequest)
|
91
91
|
lookup_by = request.app_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::CatRequest or String to lookup"
|
96
96
|
end
|
97
|
-
res = @
|
97
|
+
res = @catrequests_by_name[lookup_by]
|
98
98
|
unless res
|
99
99
|
raise ArgumentError, "Cannot find a request matching #{lookup_by} (did you define it first?)"
|
100
100
|
end
|
101
|
-
@
|
101
|
+
@catrequests[res]
|
102
102
|
end
|
103
103
|
|
104
104
|
# Transform the ruby obj -> to a Hash
|
@@ -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::CatRequest)
|
135
|
+
raise ArgumentError, "Members must be Megam::CatRequest's"
|
136
136
|
end
|
137
137
|
true
|
138
138
|
end
|
@@ -22,49 +22,49 @@ module Megam
|
|
22
22
|
|
23
23
|
JSON_CLAZ = "json_claz".freeze
|
24
24
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
MEGAM_SUBSCRIPTIONS
|
67
|
-
MEGAM_SUBSCRIPTIONSCOLLECTION
|
25
|
+
MEGAM_ACCOUNT = "Megam::Account".freeze
|
26
|
+
MEGAM_ASSEMBLIES = "Megam::Assemblies".freeze
|
27
|
+
MEGAM_ASSEMBLIESCOLLECTION = "Megam::AssembliesCollection".freeze
|
28
|
+
MEGAM_ASSEMBLY = "Megam::Assembly".freeze
|
29
|
+
MEGAM_ASSEMBLYCOLLECTION = "Megam::AssemblyCollection".freeze
|
30
|
+
MEGAM_AUTH = "Megam::Auth".freeze
|
31
|
+
MEGAM_AVAILABLEUNITS = "Megam::Availableunits".freeze
|
32
|
+
MEGAM_AVAILABLEUNITSCOLLECTION = "Megam::AvailableunitsCollection".freeze
|
33
|
+
MEGAM_BALANCES = "Megam::Balances".freeze
|
34
|
+
MEGAM_BALANCESCOLLECTION = "Megam::BalancesCollection".freeze
|
35
|
+
MEGAM_BILLINGHISTORIES = "Megam::Billinghistories".freeze
|
36
|
+
MEGAM_BILLINGHISTORIESCOLLECTION = "Megam::BillinghistoriesCollection".freeze
|
37
|
+
MEGAM_BILLINGS = "Megam::Billings".freeze
|
38
|
+
MEGAM_BILLINGSCOLLECTION = "Megam::BillingsCollection".freeze
|
39
|
+
MEGAM_CATREQUEST = "Megam::CatRequest".freeze
|
40
|
+
MEGAM_CATREQUESTCOLLECTION = "Megam::CatRequestCollection".freeze
|
41
|
+
MEGAM_CLOUDTOOLSETTING = "Megam::CloudToolSetting".freeze
|
42
|
+
MEGAM_CLOUDTOOLSETTINGCOLLECTION = "Megam::CloudToolSettingCollection".freeze
|
43
|
+
MEGAM_COMPONENTS = "Megam::Components".freeze
|
44
|
+
MEGAM_COMPONENTSCOLLECTION = "Megam::ComponentsCollection".freeze
|
45
|
+
MEGAM_CREDITHISTORIES = "Megam::Credithistories".freeze
|
46
|
+
MEGAM_CREDITHISTORIESCOLLECTION = "Megam::CredithistoriesCollection".freeze
|
47
|
+
MEGAM_CSAR = "Megam::CSAR".freeze
|
48
|
+
MEGAM_CSARCOLLECTION = "Megam::CSARCollection".freeze
|
49
|
+
MEGAM_DOMAIN = "Megam::Domains".freeze
|
50
|
+
MEGAM_DISCOUNTS = "Megam::Discounts".freeze
|
51
|
+
MEGAM_DISCOUNTSCOLLECTION = "Megam::DiscountsCollection".freeze
|
52
|
+
MEGAM_ERROR = "Megam::Error".freeze
|
53
|
+
MEGAM_EVENT = "Megam::Event".freeze
|
54
|
+
MEGAM_MARKETPLACE = "Megam::MarketPlace".freeze
|
55
|
+
MEGAM_MARKETPLACECOLLECTION = "Megam::MarketPlaceCollection".freeze
|
56
|
+
MEGAM_MARKETPLACEADDON = "Megam::MarketPlaceAddons".freeze
|
57
|
+
MEGAM_MARKETPLACEADDONCOLLECTION = "Megam::MarketPlaceAddonsCollection".freeze
|
58
|
+
MEGAM_ORGANIZATION = "Megam::Organizations".freeze
|
59
|
+
MEGAM_ORGANIZATIONSCOLLECTION = "Megam::OrganizationsCollection".freeze
|
60
|
+
MEGAM_PREDEFCLOUD = "Megam::PredefCloud".freeze
|
61
|
+
MEGAM_PREDEFCLOUDCOLLECTION = "Megam::PredefCloudCollection".freeze
|
62
|
+
MEGAM_REQUEST = "Megam::Request".freeze
|
63
|
+
MEGAM_REQUESTCOLLECTION = "Megam::RequestCollection".freeze
|
64
|
+
MEGAM_SSHKEY = "Megam::SshKey".freeze
|
65
|
+
MEGAM_SSHKEYCOLLECTION = "Megam::SshKeyCollection".freeze
|
66
|
+
MEGAM_SUBSCRIPTIONS = "Megam::Subscriptions".freeze
|
67
|
+
MEGAM_SUBSCRIPTIONSCOLLECTION = "Megam::SubscriptionsCollection".freeze
|
68
68
|
|
69
69
|
|
70
70
|
class <<self
|
@@ -191,10 +191,10 @@ module Megam
|
|
191
191
|
Megam::CSARCollection
|
192
192
|
when MEGAM_DOMAIN
|
193
193
|
Megam::Domains
|
194
|
-
when
|
195
|
-
Megam::
|
196
|
-
when
|
197
|
-
Megam::
|
194
|
+
when MEGAM_CATREQUEST
|
195
|
+
Megam::CatRequest
|
196
|
+
when MEGAM_CATREQUESTCOLLECTION
|
197
|
+
Megam::CatRequestCollection
|
198
198
|
when MEGAM_EVENT
|
199
199
|
Megam::Event
|
200
200
|
when MEGAM_AVAILABLEUNITS
|
@@ -224,7 +224,7 @@ module Megam
|
|
224
224
|
when MEGAM_SUBSCRIPTIONS
|
225
225
|
Megam::Subscriptions
|
226
226
|
when MEGAM_SUBSCRIPTIONSCOLLECTION
|
227
|
-
Megam::SubscriptionsCollection
|
227
|
+
Megam::SubscriptionsCollection
|
228
228
|
else
|
229
229
|
raise JSON::ParserError, "Unsupported `json_class` type '#{json_class}'"
|
230
230
|
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.46'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajthilak, Kishorekumar Neelamegam, Thomas Alrin, Yeshwanth Kumar, Subash Sethurajan
|
@@ -157,8 +157,6 @@ files:
|
|
157
157
|
- lib/megam/api/subscriptions.rb
|
158
158
|
- lib/megam/api/version.rb
|
159
159
|
- lib/megam/core/account.rb
|
160
|
-
- lib/megam/core/app_request.rb
|
161
|
-
- lib/megam/core/app_request_collection.rb
|
162
160
|
- lib/megam/core/assemblies.rb
|
163
161
|
- lib/megam/core/assemblies_collection.rb
|
164
162
|
- lib/megam/core/assembly.rb
|
@@ -172,6 +170,8 @@ files:
|
|
172
170
|
- lib/megam/core/billinghistories_collection.rb
|
173
171
|
- lib/megam/core/billings.rb
|
174
172
|
- lib/megam/core/billings_collection.rb
|
173
|
+
- lib/megam/core/cat_request.rb
|
174
|
+
- lib/megam/core/cat_request_collection.rb
|
175
175
|
- lib/megam/core/cloudtoolsetting.rb
|
176
176
|
- lib/megam/core/cloudtoolsetting_collection.rb
|
177
177
|
- lib/megam/core/components.rb
|