megam_api 0.40 → 0.41
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/version.rb +2 -1
- data/lib/megam/core/account.rb +3 -2
- data/lib/megam/core/assemblies.rb +2 -2
- data/lib/megam/core/assembly.rb +13 -0
- data/lib/megam/core/balances.rb +5 -5
- data/lib/megam/core/billinghistories.rb +7 -8
- data/test/test_accounts.rb +0 -1
- data/test/test_assembly.rb +1 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9c8bc9c1bbd2f46a7e18a2a4b4c7854dc8d6e64
|
4
|
+
data.tar.gz: fc575b87198bf131d2efa43ffc55b115c9dcc586
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5376f2ed4aee2d46a16defe9bf2286b0f4fc372240167ffd52f7d9814febffd7e506639f1080a89ba3cee0882fb22b728549b04ed4a275a572d0cf788439825d
|
7
|
+
data.tar.gz: fa25f71b924b0b306328fde1b04310734a8f0091ec64a0b23cee1f10576670407e7cfc01a4227872edd861eb8c15dea9af8572cf16aff6380bf3fd51fa3e0a21
|
data/lib/megam/api/version.rb
CHANGED
data/lib/megam/core/account.rb
CHANGED
@@ -167,8 +167,8 @@ module Megam
|
|
167
167
|
asm.megam_rest.get_one_assemblies(one_assemblies_id)
|
168
168
|
end
|
169
169
|
|
170
|
-
def self.list(
|
171
|
-
asm = self.new(
|
170
|
+
def self.list(params)
|
171
|
+
asm = self.new(params["email"], params["api_key"])
|
172
172
|
asm.megam_rest.get_assemblies
|
173
173
|
end
|
174
174
|
|
data/lib/megam/core/assembly.rb
CHANGED
@@ -19,6 +19,7 @@ module Megam
|
|
19
19
|
def initialize(email=nil, api_key=nil)
|
20
20
|
@id = nil
|
21
21
|
@name = nil
|
22
|
+
@tosca_type = nil
|
22
23
|
@components = []
|
23
24
|
@policies=[]
|
24
25
|
@inputs = []
|
@@ -48,6 +49,14 @@ module Megam
|
|
48
49
|
@name
|
49
50
|
end
|
50
51
|
end
|
52
|
+
|
53
|
+
def tosca_type(arg=nil)
|
54
|
+
if arg != nil
|
55
|
+
@tosca_type = arg
|
56
|
+
else
|
57
|
+
@tosca_type
|
58
|
+
end
|
59
|
+
end
|
51
60
|
|
52
61
|
def components(arg=[])
|
53
62
|
if arg != []
|
@@ -115,6 +124,7 @@ module Megam
|
|
115
124
|
index_hash["json_claz"] = self.class.name
|
116
125
|
index_hash["id"] = id
|
117
126
|
index_hash["name"] = name
|
127
|
+
index_hash["tosca_type"] = tosca_type
|
118
128
|
index_hash["components"] = components
|
119
129
|
index_hash["policies"] = policies
|
120
130
|
index_hash["inputs"] = inputs
|
@@ -135,6 +145,7 @@ module Megam
|
|
135
145
|
result = {
|
136
146
|
"id" => id,
|
137
147
|
"name" => name,
|
148
|
+
"tosca_type" => tosca_type,
|
138
149
|
"components" => components,
|
139
150
|
"policies" => policies,
|
140
151
|
"inputs" => inputs,
|
@@ -151,6 +162,7 @@ module Megam
|
|
151
162
|
asm = new
|
152
163
|
asm.id(o["id"]) if o.has_key?("id")
|
153
164
|
asm.name(o["name"]) if o.has_key?("name")
|
165
|
+
asm.tosca_type(o["tosca_type"]) if o.has_key?("tosca_type")
|
154
166
|
asm.components(o["components"]) if o.has_key?("components")
|
155
167
|
asm.policies(o["policies"]) if o.has_key?("policies") #this will be an array? can hash store array?
|
156
168
|
asm.inputs(o["inputs"]) if o.has_key?("inputs")
|
@@ -170,6 +182,7 @@ module Megam
|
|
170
182
|
def from_hash(o)
|
171
183
|
@id = o["id"] if o.has_key?("id")
|
172
184
|
@name = o["name"] if o.has_key?("name")
|
185
|
+
@tosca_type = o["tosca_type"] if o.has_key?("tosca_type")
|
173
186
|
@components = o["components"] if o.has_key?("components")
|
174
187
|
@policies = o["policies"] if o.has_key?("policies")
|
175
188
|
@inputs = o["inputs"] if o.has_key?("inputs")
|
data/lib/megam/core/balances.rb
CHANGED
@@ -166,16 +166,16 @@ module Megam
|
|
166
166
|
# Load all balances -
|
167
167
|
# returns a BalanceCollection
|
168
168
|
# don't return self. check if the Megam::BalanceCollection is returned.
|
169
|
-
def self.list(
|
170
|
-
balance = self.new(
|
169
|
+
def self.list(params)
|
170
|
+
balance = self.new(params["email"], params["api_key"])
|
171
171
|
balance.megam_rest.get_balances
|
172
172
|
end
|
173
173
|
|
174
174
|
# Show a particular balance by name,
|
175
175
|
# Megam::Balance
|
176
|
-
|
177
|
-
pre = self.new(
|
178
|
-
pre.megam_rest.get_balance(
|
176
|
+
def self.show(params)
|
177
|
+
pre = self.new(params["email"], params["api_key"])
|
178
|
+
pre.megam_rest.get_balance(params["email"])
|
179
179
|
end
|
180
180
|
|
181
181
|
def self.delete(p_name,tmp_email=nil, tmp_api_key=nil)
|
@@ -31,7 +31,6 @@ module Megam
|
|
31
31
|
self
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
34
|
def id(arg=nil)
|
36
35
|
if arg != nil
|
37
36
|
@id = arg
|
@@ -136,7 +135,7 @@ module Megam
|
|
136
135
|
#
|
137
136
|
def self.json_create(o)
|
138
137
|
bal = new
|
139
|
-
bal.id(o["id"]) if o.has_key?("id")
|
138
|
+
bal.id(o["id"]) if o.has_key?("id")
|
140
139
|
bal.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
|
141
140
|
bal.assembly_id(o["assembly_id"]) if o.has_key?("assembly_id")
|
142
141
|
bal.bill_type(o["bill_type"]) if o.has_key?("bill_type")
|
@@ -181,21 +180,21 @@ module Megam
|
|
181
180
|
# Load all billing histories -
|
182
181
|
# returns a BillingHistoriesCollection
|
183
182
|
# don't return self. check if the Megam::BillingHistoriesCollection is returned.
|
184
|
-
def self.list(
|
185
|
-
|
183
|
+
def self.list(params)
|
184
|
+
billhistory = self.new(params["email"], params["api_key"])
|
186
185
|
billhistory.megam_rest.get_billinghistories
|
187
186
|
end
|
188
187
|
|
189
188
|
# Show a particular billing history by name,
|
190
189
|
# Megam::BillingHistory
|
191
190
|
def self.show(p_name,tmp_email=nil, tmp_api_key=nil)
|
192
|
-
|
193
|
-
|
191
|
+
pre = self.new(tmp_email,tmp_api_key)
|
192
|
+
pre.megam_rest.get_billinghistory(p_name)
|
194
193
|
end
|
195
194
|
|
196
195
|
def self.delete(p_name,tmp_email=nil, tmp_api_key=nil)
|
197
|
-
|
198
|
-
|
196
|
+
pre = self.new(tmp_email,tmp_api_key)
|
197
|
+
pre.megam_rest.delete_billinghistory(p_name)
|
199
198
|
end
|
200
199
|
|
201
200
|
def to_s
|
data/test/test_accounts.rb
CHANGED
@@ -21,7 +21,6 @@ class TestAccounts < MiniTest::Unit::TestCase
|
|
21
21
|
"email" => "coolvader@enterprise.com",
|
22
22
|
"phone" => "19090909090",
|
23
23
|
"api_key" => "IamAtlas{74}NobdyCanSedfefdeME#07",
|
24
|
-
"password" => "test",
|
25
24
|
"authority" => "admin",
|
26
25
|
"password_reset_key" => "",
|
27
26
|
"created_at" => "2014-10-29 13:24:06 +0000"
|
data/test/test_assembly.rb
CHANGED