megam_api 0.93 → 0.95
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/lib/megam/api.rb +18 -4
- data/lib/megam/api/accounts.rb +19 -4
- data/lib/megam/api/assemblies.rb +15 -0
- data/lib/megam/api/assembly.rb +15 -1
- data/lib/megam/api/availableunits.rb +15 -0
- data/lib/megam/api/balances.rb +16 -1
- data/lib/megam/api/billedhistories.rb +15 -0
- data/lib/megam/api/billings.rb +15 -0
- data/lib/megam/api/components.rb +15 -0
- data/lib/megam/api/credithistories.rb +15 -0
- data/lib/megam/api/csars.rb +16 -1
- data/lib/megam/api/discounts.rb +15 -0
- data/lib/megam/api/domains.rb +32 -22
- data/lib/megam/api/errors.rb +15 -0
- data/lib/megam/api/invoices.rb +15 -0
- data/lib/megam/api/login.rb +15 -0
- data/lib/megam/api/marketplaces.rb +15 -0
- data/lib/megam/api/organizations.rb +31 -17
- data/lib/megam/api/promos.rb +18 -3
- data/lib/megam/api/requests.rb +15 -0
- data/lib/megam/api/sensors.rb +15 -0
- data/lib/megam/api/sshkeys.rb +15 -0
- data/lib/megam/api/subscriptions.rb +15 -0
- data/lib/megam/api/version.rb +16 -1
- data/lib/megam/core/account.rb +1 -1
- data/lib/megam/core/assemblies.rb +1 -1
- data/lib/megam/core/assemblies_collection.rb +1 -1
- data/lib/megam/core/assembly.rb +1 -1
- data/lib/megam/core/assembly_collection.rb +1 -1
- data/lib/megam/core/auth.rb +1 -1
- data/lib/megam/core/availableunits.rb +1 -1
- data/lib/megam/core/availableunits_collection.rb +1 -1
- data/lib/megam/core/balances.rb +4 -5
- data/lib/megam/core/balances_collection.rb +1 -1
- data/lib/megam/core/billedhistories.rb +4 -5
- data/lib/megam/core/billedhistories_collection.rb +1 -1
- data/lib/megam/core/billings.rb +4 -4
- data/lib/megam/core/billings_collection.rb +1 -1
- data/lib/megam/core/components.rb +1 -1
- data/lib/megam/core/components_collection.rb +1 -1
- data/lib/megam/core/config.rb +1 -1
- data/lib/megam/core/credithistories.rb +1 -1
- data/lib/megam/core/credithistories_collection.rb +1 -1
- data/lib/megam/core/csar.rb +1 -1
- data/lib/megam/core/csar_collection.rb +1 -1
- data/lib/megam/core/discounts.rb +1 -1
- data/lib/megam/core/discounts_collection.rb +1 -1
- data/lib/megam/core/domain_collection.rb +144 -0
- data/lib/megam/core/domains.rb +76 -85
- data/lib/megam/core/error.rb +1 -1
- data/lib/megam/core/invoices.rb +1 -1
- data/lib/megam/core/invoices_collection.rb +1 -1
- data/lib/megam/core/json_compat.rb +3 -0
- data/lib/megam/core/konipai.rb +1 -1
- data/lib/megam/core/marketplace.rb +1 -1
- data/lib/megam/core/marketplace_collection.rb +1 -1
- data/lib/megam/core/organizations.rb +1 -3
- data/lib/megam/core/organizations_collection.rb +1 -1
- data/lib/megam/core/promos.rb +1 -1
- data/lib/megam/core/request.rb +1 -1
- data/lib/megam/core/request_collection.rb +1 -1
- data/lib/megam/core/sensors.rb +1 -1
- data/lib/megam/core/sensors_collection.rb +1 -1
- data/lib/megam/core/server_api.rb +1 -1
- data/lib/megam/core/sshkey.rb +1 -1
- data/lib/megam/core/sshkey_collection.rb +1 -1
- data/lib/megam/core/subscriptions.rb +1 -1
- data/lib/megam/core/subscriptions_collection.rb +1 -1
- data/lib/megam/mixins/assemblies.rb +15 -0
- data/lib/megam/mixins/assembly.rb +16 -0
- data/lib/megam/mixins/common_deployable.rb +15 -0
- data/lib/megam/mixins/components.rb +15 -0
- data/lib/megam/mixins/megam_attributes.rb +15 -0
- data/lib/megam/mixins/outputs.rb +15 -0
- data/lib/megam/mixins/policies.rb +15 -0
- data/lib/megam_api.rb +15 -0
- data/megam_api.gemspec +6 -6
- data/test/test_accounts.rb +46 -9
- data/test/test_assemblies.rb +7 -7
- data/test/test_assembly.rb +4 -4
- data/test/test_availableunits.rb +3 -4
- data/test/test_balances.rb +9 -10
- data/test/test_billedhistories.rb +4 -4
- data/test/test_billings.rb +1 -2
- data/test/test_components.rb +4 -4
- data/test/test_credithistories.rb +3 -4
- data/test/test_csars.rb +2 -1
- data/test/test_discounts.rb +4 -5
- data/test/test_domains.rb +8 -7
- data/test/test_invoices.rb +2 -2
- data/test/test_marketplaces.rb +4 -4
- data/test/test_organizations.rb +3 -3
- data/test/test_requests.rb +1 -1
- data/test/test_sshkeys.rb +15 -14
- metadata +41 -12
@@ -1,3 +1,18 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Megam
|
2
17
|
class API
|
3
18
|
|
@@ -1,7 +1,21 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Megam
|
2
17
|
class API
|
3
18
|
def get_organizations
|
4
|
-
|
5
19
|
@options = {:path => '/organizations',:body => ''}.merge(@options)
|
6
20
|
|
7
21
|
request(
|
@@ -9,43 +23,43 @@ module Megam
|
|
9
23
|
:method => :get,
|
10
24
|
:body => @options[:body]
|
11
25
|
|
12
|
-
|
26
|
+
)
|
13
27
|
end
|
14
28
|
|
15
29
|
def get_organization(id)
|
16
30
|
|
17
31
|
@options = {:path => "/organizations/#{id}",
|
18
|
-
|
32
|
+
:body => ''}.merge(@options)
|
19
33
|
|
20
34
|
request(
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
35
|
+
:expects => 200,
|
36
|
+
:method => :get,
|
37
|
+
:body => @options[:body]
|
38
|
+
)
|
25
39
|
end
|
26
40
|
|
27
41
|
def post_organization(new_organization)
|
28
42
|
|
29
43
|
@options = {:path => '/organizations/content',
|
30
|
-
|
44
|
+
:body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
|
31
45
|
|
32
46
|
request(
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
47
|
+
:expects => 201,
|
48
|
+
:method => :post,
|
49
|
+
:body => @options[:body]
|
50
|
+
)
|
37
51
|
end
|
38
52
|
|
39
53
|
def update_organization(new_organization)
|
40
54
|
|
41
55
|
@options = {:path => '/organizations/update',
|
42
|
-
|
56
|
+
:body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
|
43
57
|
|
44
58
|
request(
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
59
|
+
:expects => 201,
|
60
|
+
:method => :post,
|
61
|
+
:body => @options[:body]
|
62
|
+
)
|
49
63
|
end
|
50
64
|
end
|
51
65
|
end
|
data/lib/megam/api/promos.rb
CHANGED
@@ -1,10 +1,25 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Megam
|
2
17
|
class API
|
3
|
-
|
18
|
+
|
4
19
|
|
5
20
|
def get_promos(id)
|
6
21
|
@options = {:path => "/promos/#{id}", :body => ""}.merge(@options)
|
7
|
-
|
22
|
+
|
8
23
|
request(
|
9
24
|
:expects => 200,
|
10
25
|
:method => :get,
|
@@ -12,7 +27,7 @@ module Megam
|
|
12
27
|
)
|
13
28
|
end
|
14
29
|
|
15
|
-
|
30
|
+
|
16
31
|
|
17
32
|
end
|
18
33
|
end
|
data/lib/megam/api/requests.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Megam
|
2
17
|
class API
|
3
18
|
|
data/lib/megam/api/sensors.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Megam
|
2
17
|
class API
|
3
18
|
def get_sensors
|
data/lib/megam/api/sshkeys.rb
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Megam
|
2
17
|
class API
|
3
18
|
def get_sshkeys
|
@@ -1,3 +1,18 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Megam
|
2
17
|
class API
|
3
18
|
def get_subscriptions
|
data/lib/megam/api/version.rb
CHANGED
@@ -1,5 +1,20 @@
|
|
1
|
+
# Copyright:: Copyright (c) 2013-2016 Megam Systems
|
2
|
+
# License:: Apache License, Version 2.0
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
1
16
|
module Megam
|
2
17
|
class API
|
3
|
-
VERSION = "0.
|
18
|
+
VERSION = "0.95"
|
4
19
|
end
|
5
20
|
end
|
data/lib/megam/core/account.rb
CHANGED
data/lib/megam/core/assembly.rb
CHANGED
data/lib/megam/core/auth.rb
CHANGED
data/lib/megam/core/balances.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
##
|
2
|
-
## Copyright
|
2
|
+
## Copyright 2013-2016 Megam Systems
|
3
3
|
##
|
4
4
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
## you may not use this file except in compliance with the License.
|
@@ -15,7 +15,7 @@
|
|
15
15
|
##
|
16
16
|
module Megam
|
17
17
|
class Balances < Megam::ServerAPI
|
18
|
-
def initialize(
|
18
|
+
def initialize(o)
|
19
19
|
@id = nil
|
20
20
|
@accounts_id = nil
|
21
21
|
@name = nil
|
@@ -23,7 +23,7 @@ module Megam
|
|
23
23
|
@created_at = nil
|
24
24
|
@updated_at = nil
|
25
25
|
@some_msg = {}
|
26
|
-
super(
|
26
|
+
super(o)
|
27
27
|
end
|
28
28
|
|
29
29
|
def balances
|
@@ -122,7 +122,7 @@ module Megam
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def self.json_create(o)
|
125
|
-
balances = new
|
125
|
+
balances = new({})
|
126
126
|
balances.id(o["id"]) if o.has_key?("id")
|
127
127
|
balances.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
|
128
128
|
balances.name(o["name"]) if o.has_key?("name")
|
@@ -199,4 +199,3 @@ module Megam
|
|
199
199
|
|
200
200
|
end
|
201
201
|
end
|
202
|
-
|
@@ -1,5 +1,5 @@
|
|
1
1
|
##
|
2
|
-
## Copyright
|
2
|
+
## Copyright 2013-2016 Megam Systems
|
3
3
|
##
|
4
4
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
## you may not use this file except in compliance with the License.
|
@@ -15,7 +15,7 @@
|
|
15
15
|
##
|
16
16
|
module Megam
|
17
17
|
class Billedhistories < Megam::ServerAPI
|
18
|
-
def initialize(
|
18
|
+
def initialize(o)
|
19
19
|
@id = nil
|
20
20
|
@accounts_id = nil
|
21
21
|
@assembly_id = nil
|
@@ -24,7 +24,7 @@ module Megam
|
|
24
24
|
@currency_type = nil
|
25
25
|
@created_at = nil
|
26
26
|
@some_msg = {}
|
27
|
-
super(
|
27
|
+
super(o)
|
28
28
|
end
|
29
29
|
|
30
30
|
def billedhistories
|
@@ -134,7 +134,7 @@ module Megam
|
|
134
134
|
|
135
135
|
#
|
136
136
|
def self.json_create(o)
|
137
|
-
bal = new
|
137
|
+
bal = new({})
|
138
138
|
bal.id(o["id"]) if o.has_key?("id")
|
139
139
|
bal.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
|
140
140
|
bal.assembly_id(o["assembly_id"]) if o.has_key?("assembly_id")
|
@@ -203,4 +203,3 @@ module Megam
|
|
203
203
|
|
204
204
|
end
|
205
205
|
end
|
206
|
-
|
data/lib/megam/core/billings.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
##
|
2
|
-
## Copyright
|
2
|
+
## Copyright 2013-2016 Megam Systems
|
3
3
|
##
|
4
4
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
## you may not use this file except in compliance with the License.
|
@@ -15,7 +15,7 @@
|
|
15
15
|
##
|
16
16
|
module Megam
|
17
17
|
class Billings < Megam::ServerAPI
|
18
|
-
|
18
|
+
|
19
19
|
def initialize(email=nil, api_key=nil, host=nil)
|
20
20
|
@id = nil
|
21
21
|
@accounts_id = nil
|
@@ -35,7 +35,7 @@ module Megam
|
|
35
35
|
self
|
36
36
|
end
|
37
37
|
|
38
|
-
|
38
|
+
|
39
39
|
def id(arg=nil)
|
40
40
|
if arg != nil
|
41
41
|
@id = arg
|
@@ -99,7 +99,7 @@ module Megam
|
|
99
99
|
@phone
|
100
100
|
end
|
101
101
|
end
|
102
|
-
|
102
|
+
|
103
103
|
def bill_type(arg=nil)
|
104
104
|
if arg != nil
|
105
105
|
@bill_type = arg
|