megam_api 0.45 → 0.46

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: 12ba31c76501eabd0b6d458cbce0c454551d468b
4
- data.tar.gz: 291d5783e2fea6f8f946be490cfc4d42deb768c2
3
+ metadata.gz: 61eb2232a462dbf1262c79227b1169c26241f21d
4
+ data.tar.gz: a29989ef635219275f8bda5206e315a4c81d0984
5
5
  SHA512:
6
- metadata.gz: c0271f01f4f3e7d5b5adae2bc53060b157c257ecd95a937b618fa2395bc368f10de18d37002927eda726b626e773a0a293a4227208a502a64bdcaeb6f3de4d78
7
- data.tar.gz: a10eaf2b174107e8df8b558df473a7118b2637ab9b7499eaace5db2d301da39b28ceb2745cf6f5dbd12cbc13916d50ad82d8be26393f9689e580a6f8afbcb48b
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/app_requests"
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/app_request"
76
- require "megam/core/app_request_collection"
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, {})
@@ -1,8 +1,8 @@
1
1
  module Megam
2
2
  class API
3
3
 
4
- def post_apprequest(new_req)
5
- @options = {:path => '/apprequests/content',
4
+ def post_catrequest(new_req)
5
+ @options = {:path => '/catrequests/content',
6
6
  :body => Megam::JSONCompat.to_json(new_req)}.merge(@options)
7
7
 
8
8
  request(
@@ -1,5 +1,5 @@
1
1
  module Megam
2
2
  class API
3
- VERSION = "0.45"
3
+ VERSION = "0.46"
4
4
  end
5
5
  end
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module Megam
17
- class AppRequest < Megam::ServerAPI
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 app_request
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.post_apprequest(to_hash)
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 AppRequestCollection
17
+ class CatRequestCollection
18
18
  include Enumerable
19
19
 
20
20
  attr_reader :iterator
21
21
  def initialize
22
- @apprequests = Array.new
23
- @apprequests_by_name = Hash.new
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
- @apprequests
28
+ @catrequests
29
29
  end
30
30
 
31
31
  def [](index)
32
- @apprequests[index]
32
+ @catrequests[index]
33
33
  end
34
34
 
35
35
  def []=(index, arg)
36
36
  is_megam_request(arg)
37
- @apprequests[index] = arg
38
- @apprequests_by_name[arg.app_id] = index
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
- @apprequests << a
45
- @apprequests_by_name[a.app_id] = @apprequests.length - 1
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
- @apprequests.insert(@insert_after_idx + 1, request)
59
+ @catrequests.insert(@insert_after_idx + 1, request)
60
60
  # update name -> location mappings and register new request
61
- @apprequests_by_name.each_key do |key|
62
- @apprequests_by_name[key] += 1 if @apprequests_by_name[key] > @insert_after_idx
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
- @apprequests_by_name[request.app_id] = @insert_after_idx + 1
64
+ @catrequests_by_name[request.app_id] = @insert_after_idx + 1
65
65
  @insert_after_idx += 1
66
66
  else
67
- @apprequests << request
68
- @apprequests_by_name[request.app_id] = @apprequests.length - 1
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
- @apprequests.each do |request|
73
+ @catrequests.each do |request|
74
74
  yield request
75
75
  end
76
76
  end
77
77
 
78
78
  def each_index
79
- @apprequests.each_index do |i|
79
+ @catrequests.each_index do |i|
80
80
  yield i
81
81
  end
82
82
  end
83
83
 
84
84
  def empty?
85
- @apprequests.empty?
85
+ @catrequests.empty?
86
86
  end
87
87
 
88
88
  def lookup(request)
89
89
  lookup_by = nil
90
- if request.kind_of?(Megam::AppRequest)
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::AppRequest or String to lookup"
95
+ raise ArgumentError, "Must pass a Megam::CatRequest or String to lookup"
96
96
  end
97
- res = @apprequests_by_name[lookup_by]
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
- @apprequests[res]
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::AppRequest)
135
- raise ArgumentError, "Members must be Megam::AppRequest's"
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
- MEGAM_AUTH = "Megam::Auth".freeze
26
- MEGAM_ERROR = "Megam::Error".freeze
27
- MEGAM_ACCOUNT = "Megam::Account".freeze
28
- MEGAM_ASSEMBLIES = "Megam::Assemblies".freeze
29
- MEGAM_ASSEMBLIESCOLLECTION = "Megam::AssembliesCollection".freeze
30
- MEGAM_ASSEMBLY = "Megam::Assembly".freeze
31
- MEGAM_ASSEMBLYCOLLECTION = "Megam::AssemblyCollection".freeze
32
- MEGAM_COMPONENTS = "Megam::Components".freeze
33
- MEGAM_COMPONENTSCOLLECTION = "Megam::ComponentsCollection".freeze
34
- MEGAM_REQUEST = "Megam::Request".freeze
35
- MEGAM_REQUESTCOLLECTION = "Megam::RequestCollection".freeze
36
- MEGAM_ORGANIZATION = "Megam::Organizations".freeze
37
- MEGAM_ORGANIZATIONSCOLLECTION = "Megam::OrganizationsCollection".freeze
38
- MEGAM_DOMAIN = "Megam::Domains".freeze
39
- MEGAM_APPREQUEST = "Megam::AppRequest".freeze
40
- MEGAM_APPREQUESTCOLLECTION = "Megam::AppRequestCollection".freeze
41
- MEGAM_EVENT = "Megam::Event".freeze
42
- MEGAM_PREDEFCLOUD = "Megam::PredefCloud".freeze
43
- MEGAM_PREDEFCLOUDCOLLECTION = "Megam::PredefCloudCollection".freeze
44
- MEGAM_CLOUDTOOLSETTING = "Megam::CloudToolSetting".freeze
45
- MEGAM_CLOUDTOOLSETTINGCOLLECTION = "Megam::CloudToolSettingCollection".freeze
46
- MEGAM_SSHKEY = "Megam::SshKey".freeze
47
- MEGAM_SSHKEYCOLLECTION = "Megam::SshKeyCollection".freeze
48
- MEGAM_MARKETPLACE = "Megam::MarketPlace".freeze
49
- MEGAM_MARKETPLACECOLLECTION = "Megam::MarketPlaceCollection".freeze
50
- MEGAM_MARKETPLACEADDON = "Megam::MarketPlaceAddons".freeze
51
- MEGAM_MARKETPLACEADDONCOLLECTION = "Megam::MarketPlaceAddonsCollection".freeze
52
- MEGAM_CSAR = "Megam::CSAR".freeze
53
- MEGAM_CSARCOLLECTION = "Megam::CSARCollection".freeze
54
- MEGAM_AVAILABLEUNITS = "Megam::Availableunits".freeze
55
- MEGAM_AVAILABLEUNITSCOLLECTION = "Megam::AvailableunitsCollection".freeze
56
- MEGAM_BALANCES = "Megam::Balances".freeze
57
- MEGAM_BALANCESCOLLECTION = "Megam::BalancesCollection".freeze
58
- MEGAM_BILLINGHISTORIES = "Megam::Billinghistories".freeze
59
- MEGAM_BILLINGHISTORIESCOLLECTION = "Megam::BillinghistoriesCollection".freeze
60
- MEGAM_BILLINGS = "Megam::Billings".freeze
61
- MEGAM_BILLINGSCOLLECTION = "Megam::BillingsCollection".freeze
62
- MEGAM_CREDITHISTORIES = "Megam::Credithistories".freeze
63
- MEGAM_CREDITHISTORIESCOLLECTION = "Megam::CredithistoriesCollection".freeze
64
- MEGAM_DISCOUNTS = "Megam::Discounts".freeze
65
- MEGAM_DISCOUNTSCOLLECTION = "Megam::DiscountsCollection".freeze
66
- MEGAM_SUBSCRIPTIONS = "Megam::Subscriptions".freeze
67
- MEGAM_SUBSCRIPTIONSCOLLECTION = "Megam::SubscriptionsCollection".freeze
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 MEGAM_APPREQUEST
195
- Megam::AppRequest
196
- when MEGAM_APPREQUESTCOLLECTION
197
- Megam::AppRequestCollection
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.45'
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