megam_api 0.93 → 0.95

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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/lib/megam/api.rb +18 -4
  4. data/lib/megam/api/accounts.rb +19 -4
  5. data/lib/megam/api/assemblies.rb +15 -0
  6. data/lib/megam/api/assembly.rb +15 -1
  7. data/lib/megam/api/availableunits.rb +15 -0
  8. data/lib/megam/api/balances.rb +16 -1
  9. data/lib/megam/api/billedhistories.rb +15 -0
  10. data/lib/megam/api/billings.rb +15 -0
  11. data/lib/megam/api/components.rb +15 -0
  12. data/lib/megam/api/credithistories.rb +15 -0
  13. data/lib/megam/api/csars.rb +16 -1
  14. data/lib/megam/api/discounts.rb +15 -0
  15. data/lib/megam/api/domains.rb +32 -22
  16. data/lib/megam/api/errors.rb +15 -0
  17. data/lib/megam/api/invoices.rb +15 -0
  18. data/lib/megam/api/login.rb +15 -0
  19. data/lib/megam/api/marketplaces.rb +15 -0
  20. data/lib/megam/api/organizations.rb +31 -17
  21. data/lib/megam/api/promos.rb +18 -3
  22. data/lib/megam/api/requests.rb +15 -0
  23. data/lib/megam/api/sensors.rb +15 -0
  24. data/lib/megam/api/sshkeys.rb +15 -0
  25. data/lib/megam/api/subscriptions.rb +15 -0
  26. data/lib/megam/api/version.rb +16 -1
  27. data/lib/megam/core/account.rb +1 -1
  28. data/lib/megam/core/assemblies.rb +1 -1
  29. data/lib/megam/core/assemblies_collection.rb +1 -1
  30. data/lib/megam/core/assembly.rb +1 -1
  31. data/lib/megam/core/assembly_collection.rb +1 -1
  32. data/lib/megam/core/auth.rb +1 -1
  33. data/lib/megam/core/availableunits.rb +1 -1
  34. data/lib/megam/core/availableunits_collection.rb +1 -1
  35. data/lib/megam/core/balances.rb +4 -5
  36. data/lib/megam/core/balances_collection.rb +1 -1
  37. data/lib/megam/core/billedhistories.rb +4 -5
  38. data/lib/megam/core/billedhistories_collection.rb +1 -1
  39. data/lib/megam/core/billings.rb +4 -4
  40. data/lib/megam/core/billings_collection.rb +1 -1
  41. data/lib/megam/core/components.rb +1 -1
  42. data/lib/megam/core/components_collection.rb +1 -1
  43. data/lib/megam/core/config.rb +1 -1
  44. data/lib/megam/core/credithistories.rb +1 -1
  45. data/lib/megam/core/credithistories_collection.rb +1 -1
  46. data/lib/megam/core/csar.rb +1 -1
  47. data/lib/megam/core/csar_collection.rb +1 -1
  48. data/lib/megam/core/discounts.rb +1 -1
  49. data/lib/megam/core/discounts_collection.rb +1 -1
  50. data/lib/megam/core/domain_collection.rb +144 -0
  51. data/lib/megam/core/domains.rb +76 -85
  52. data/lib/megam/core/error.rb +1 -1
  53. data/lib/megam/core/invoices.rb +1 -1
  54. data/lib/megam/core/invoices_collection.rb +1 -1
  55. data/lib/megam/core/json_compat.rb +3 -0
  56. data/lib/megam/core/konipai.rb +1 -1
  57. data/lib/megam/core/marketplace.rb +1 -1
  58. data/lib/megam/core/marketplace_collection.rb +1 -1
  59. data/lib/megam/core/organizations.rb +1 -3
  60. data/lib/megam/core/organizations_collection.rb +1 -1
  61. data/lib/megam/core/promos.rb +1 -1
  62. data/lib/megam/core/request.rb +1 -1
  63. data/lib/megam/core/request_collection.rb +1 -1
  64. data/lib/megam/core/sensors.rb +1 -1
  65. data/lib/megam/core/sensors_collection.rb +1 -1
  66. data/lib/megam/core/server_api.rb +1 -1
  67. data/lib/megam/core/sshkey.rb +1 -1
  68. data/lib/megam/core/sshkey_collection.rb +1 -1
  69. data/lib/megam/core/subscriptions.rb +1 -1
  70. data/lib/megam/core/subscriptions_collection.rb +1 -1
  71. data/lib/megam/mixins/assemblies.rb +15 -0
  72. data/lib/megam/mixins/assembly.rb +16 -0
  73. data/lib/megam/mixins/common_deployable.rb +15 -0
  74. data/lib/megam/mixins/components.rb +15 -0
  75. data/lib/megam/mixins/megam_attributes.rb +15 -0
  76. data/lib/megam/mixins/outputs.rb +15 -0
  77. data/lib/megam/mixins/policies.rb +15 -0
  78. data/lib/megam_api.rb +15 -0
  79. data/megam_api.gemspec +6 -6
  80. data/test/test_accounts.rb +46 -9
  81. data/test/test_assemblies.rb +7 -7
  82. data/test/test_assembly.rb +4 -4
  83. data/test/test_availableunits.rb +3 -4
  84. data/test/test_balances.rb +9 -10
  85. data/test/test_billedhistories.rb +4 -4
  86. data/test/test_billings.rb +1 -2
  87. data/test/test_components.rb +4 -4
  88. data/test/test_credithistories.rb +3 -4
  89. data/test/test_csars.rb +2 -1
  90. data/test/test_discounts.rb +4 -5
  91. data/test/test_domains.rb +8 -7
  92. data/test/test_invoices.rb +2 -2
  93. data/test/test_marketplaces.rb +4 -4
  94. data/test/test_organizations.rb +3 -3
  95. data/test/test_requests.rb +1 -1
  96. data/test/test_sshkeys.rb +15 -14
  97. 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
- :body => ''}.merge(@options)
32
+ :body => ''}.merge(@options)
19
33
 
20
34
  request(
21
- :expects => 200,
22
- :method => :get,
23
- :body => @options[:body]
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
- :body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
44
+ :body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
31
45
 
32
46
  request(
33
- :expects => 201,
34
- :method => :post,
35
- :body => @options[:body]
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
- :body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
56
+ :body => Megam::JSONCompat.to_json(new_organization)}.merge(@options)
43
57
 
44
58
  request(
45
- :expects => 201,
46
- :method => :post,
47
- :body => @options[:body]
48
- )
59
+ :expects => 201,
60
+ :method => :post,
61
+ :body => @options[:body]
62
+ )
49
63
  end
50
64
  end
51
65
  end
@@ -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
@@ -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,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
@@ -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
@@ -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.93"
18
+ VERSION = "0.95"
4
19
  end
5
20
  end
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2012-2015 Megam Systems, Inc.
1
+ # Copyright:: 2013-2016 Megam Systems, Inc.
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2012, 2014 Megam Systems
1
+ # Copyright:: Copyright (c) 2013-2016 Megam Systems
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2012, 2014 Megam Systems
1
+ # Copyright:: Copyright (c) 2013-2016 Megam Systems
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2012, 2014 Megam Systems
1
+ # Copyright:: Copyright (c) 2013-2016 Megam Systems
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2012, 2014 Megam Systems
1
+ # Copyright:: Copyright (c) 2013-2016 Megam Systems
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2012-2013 Megam Systems, Inc.
1
+ # Copyright:: Copyright (c) 2013-2016 Megam Systems, Inc.
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,5 @@
1
1
  ##
2
- ## Copyright [2013-2015] [Megam Systems]
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.
@@ -1,5 +1,5 @@
1
1
  ##
2
- ## Copyright [2013-2015] [Megam Systems]
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.
@@ -1,5 +1,5 @@
1
1
  ##
2
- ## Copyright [2013-2015] [Megam Systems]
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(email=nil, api_key=nil, host=nil)
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(email, api_key, host)
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 [2013-2015] [Megam Systems]
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.
@@ -1,5 +1,5 @@
1
1
  ##
2
- ## Copyright [2013-2015] [Megam Systems]
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(email=nil, api_key=nil, host=nil)
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(email, api_key, host)
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
-
@@ -1,5 +1,5 @@
1
1
  ##
2
- ## Copyright [2013-2015] [Megam Systems]
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.
@@ -1,5 +1,5 @@
1
1
  ##
2
- ## Copyright [2013-2015] [Megam Systems]
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
@@ -1,5 +1,5 @@
1
1
  ##
2
- ## Copyright [2013-2015] [Megam Systems]
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.
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2012, 2014 Megam Systems
1
+ # Copyright:: Copyright (c) 2013-2016 Megam Systems
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright (c) 2012, 2014 Megam Systems
1
+ # Copyright:: Copyright (c) 2013-2016 Megam Systems
2
2
  # License:: Apache License, Version 2.0
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");