megam_api 1.5.rc5 → 1.5.rc7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -2
  3. data/LICENSE +21 -202
  4. data/README.md +3 -20
  5. data/lib/megam/api.rb +154 -169
  6. data/lib/megam/api/accounts.rb +0 -15
  7. data/lib/megam/api/assemblies.rb +0 -15
  8. data/lib/megam/api/assembly.rb +0 -15
  9. data/lib/megam/api/balances.rb +0 -15
  10. data/lib/megam/api/billedhistories.rb +0 -15
  11. data/lib/megam/api/billingtransactions.rb +0 -15
  12. data/lib/megam/api/components.rb +0 -15
  13. data/lib/megam/api/domains.rb +0 -15
  14. data/lib/megam/api/errors.rb +0 -15
  15. data/lib/megam/api/eventsbilling.rb +0 -15
  16. data/lib/megam/api/eventscontainer.rb +0 -15
  17. data/lib/megam/api/eventsstorage.rb +0 -15
  18. data/lib/megam/api/eventsvm.rb +0 -15
  19. data/lib/megam/api/marketplaces.rb +0 -15
  20. data/lib/megam/api/organizations.rb +0 -15
  21. data/lib/megam/api/promos.rb +0 -15
  22. data/lib/megam/api/requests.rb +0 -15
  23. data/lib/megam/api/sensors.rb +0 -15
  24. data/lib/megam/api/snapshots.rb +0 -15
  25. data/lib/megam/api/sshkeys.rb +0 -15
  26. data/lib/megam/api/version.rb +1 -16
  27. data/lib/megam/core/account.rb +241 -60
  28. data/lib/megam/core/assemblies.rb +0 -16
  29. data/lib/megam/core/assemblies_collection.rb +101 -116
  30. data/lib/megam/core/assembly.rb +201 -218
  31. data/lib/megam/core/assembly_collection.rb +101 -116
  32. data/lib/megam/core/balances.rb +182 -197
  33. data/lib/megam/core/balances_collection.rb +101 -116
  34. data/lib/megam/core/billedhistories.rb +186 -201
  35. data/lib/megam/core/billedhistories_collection.rb +101 -116
  36. data/lib/megam/core/billingtransactions.rb +0 -15
  37. data/lib/megam/core/billingtransactions_collection.rb +0 -15
  38. data/lib/megam/core/components.rb +300 -316
  39. data/lib/megam/core/components_collection.rb +0 -15
  40. data/lib/megam/core/domain_collection.rb +1 -16
  41. data/lib/megam/core/domains.rb +115 -131
  42. data/lib/megam/core/error.rb +55 -70
  43. data/lib/megam/core/eventsbilling.rb +0 -16
  44. data/lib/megam/core/eventsbilling_collection.rb +101 -116
  45. data/lib/megam/core/eventscontainer.rb +0 -16
  46. data/lib/megam/core/eventscontainer_collection.rb +101 -116
  47. data/lib/megam/core/eventsstorage.rb +0 -16
  48. data/lib/megam/core/eventsstorage_collection.rb +0 -15
  49. data/lib/megam/core/eventsvm.rb +0 -16
  50. data/lib/megam/core/eventsvm_collection.rb +101 -116
  51. data/lib/megam/core/json_compat.rb +0 -12
  52. data/lib/megam/core/konipai.rb +0 -15
  53. data/lib/megam/core/log.rb +0 -15
  54. data/lib/megam/core/marketplace.rb +224 -241
  55. data/lib/megam/core/marketplace_collection.rb +0 -15
  56. data/lib/megam/core/organizations.rb +0 -16
  57. data/lib/megam/core/organizations_collection.rb +0 -15
  58. data/lib/megam/core/promos.rb +0 -15
  59. data/lib/megam/core/request.rb +0 -15
  60. data/lib/megam/core/request_collection.rb +0 -15
  61. data/lib/megam/core/rest_adapter.rb +0 -15
  62. data/lib/megam/core/sensors.rb +138 -154
  63. data/lib/megam/core/sensors_collection.rb +0 -15
  64. data/lib/megam/core/snapshots.rb +0 -16
  65. data/lib/megam/core/snapshots_collection.rb +0 -15
  66. data/lib/megam/core/sshkey.rb +169 -184
  67. data/lib/megam/core/sshkey_collection.rb +0 -15
  68. data/lib/megam/core/stuff.rb +17 -32
  69. data/lib/megam/core/text.rb +82 -97
  70. data/lib/megam/mixins/assemblies.rb +10 -25
  71. data/lib/megam/mixins/assembly.rb +33 -49
  72. data/lib/megam/mixins/common_deployable.rb +64 -79
  73. data/lib/megam/mixins/components.rb +160 -175
  74. data/lib/megam/mixins/megam_attributes.rb +22 -37
  75. data/lib/megam/mixins/outputs.rb +14 -29
  76. data/lib/megam/mixins/policies.rb +21 -36
  77. data/lib/megam_api.rb +0 -15
  78. data/test/mixins/test_assemblies.rb +1 -2
  79. data/test/test_accounts.rb +84 -29
  80. data/test/test_billingtranscations.rb +17 -21
  81. data/test/test_eventscontainer.rb +19 -23
  82. data/test/test_eventsstorage.rb +8 -10
  83. data/test/test_eventsvm.rb +19 -23
  84. data/test/test_helper.rb +30 -30
  85. data/test/test_snapshots.rb +16 -22
  86. metadata +2 -2
@@ -1,137 +1,122 @@
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
- #
16
1
  module Megam
17
- class AssemblyCollection
18
- include Enumerable
19
-
20
- attr_reader :iterator
21
- def initialize
22
- @assemblys = Array.new
23
- @assemblys_by_name = Hash.new
24
- @insert_after_idx = nil
25
- end
2
+ class AssemblyCollection
3
+ include Enumerable
4
+
5
+ attr_reader :iterator
6
+ def initialize
7
+ @assemblys = Array.new
8
+ @assemblys_by_name = Hash.new
9
+ @insert_after_idx = nil
10
+ end
26
11
 
27
- def all_assemblys
28
- @assemblys
29
- end
12
+ def all_assemblys
13
+ @assemblys
14
+ end
30
15
 
31
- def [](index)
32
- @assemblys[index]
33
- end
16
+ def [](index)
17
+ @assemblys[index]
18
+ end
34
19
 
35
- def []=(index, arg)
36
- is_megam_assemblys(arg)
37
- @assemblys[index] = arg
38
- @assemblys_by_name[arg.name] = index
39
- end
20
+ def []=(index, arg)
21
+ is_megam_assemblys(arg)
22
+ @assemblys[index] = arg
23
+ @assemblys_by_name[arg.name] = index
24
+ end
40
25
 
41
- def <<(*args)
42
- args.flatten.each do |a|
43
- is_megam_assemblys(a)
44
- @assemblys << a
45
- @assemblys_by_name[a.name] = @assemblys.length - 1
46
- end
47
- self
48
- end
26
+ def <<(*args)
27
+ args.flatten.each do |a|
28
+ is_megam_assemblys(a)
29
+ @assemblys << a
30
+ @assemblys_by_name[a.name] = @assemblys.length - 1
31
+ end
32
+ self
33
+ end
49
34
 
50
- # 'push' is an alias method to <<
51
- alias_method :push, :<<
52
-
53
- def insert(assemblys)
54
- is_megam_assemblys(assemblys)
55
- if @insert_after_idx
56
- # in the middle of executing a run, so any nodes inserted now should
57
- # be placed after the most recent addition done by the currently executing
58
- # node
59
- @assemblys.insert(@insert_after_idx + 1, assemblys)
60
- # update name -> location mappings and register new node
61
- @assemblys_by_name.each_key do |key|
62
- @assemblys_by_name[key] += 1 if @assemblys_by_name[key] > @insert_after_idx
35
+ # 'push' is an alias method to <<
36
+ alias_method :push, :<<
37
+
38
+ def insert(assemblys)
39
+ is_megam_assemblys(assemblys)
40
+ if @insert_after_idx
41
+ # in the middle of executing a run, so any nodes inserted now should
42
+ # be placed after the most recent addition done by the currently executing
43
+ # node
44
+ @assemblys.insert(@insert_after_idx + 1, assemblys)
45
+ # update name -> location mappings and register new node
46
+ @assemblys_by_name.each_key do |key|
47
+ @assemblys_by_name[key] += 1 if @assemblys_by_name[key] > @insert_after_idx
48
+ end
49
+ @assemblys_by_name[assemblys.name] = @insert_after_idx + 1
50
+ @insert_after_idx += 1
51
+ else
52
+ @assemblys << assemblys
53
+ @assemblys_by_name[assemblys.name] = @assemblys.length - 1
54
+ end
63
55
  end
64
- @assemblys_by_name[assemblys.name] = @insert_after_idx + 1
65
- @insert_after_idx += 1
66
- else
67
- @assemblys << assemblys
68
- @assemblys_by_name[assemblys.name] = @assemblys.length - 1
69
- end
70
- end
71
56
 
72
- def each
73
- @assemblys.each do |assemblys|
74
- yield assemblys
75
- end
76
- end
57
+ def each
58
+ @assemblys.each do |assemblys|
59
+ yield assemblys
60
+ end
61
+ end
77
62
 
78
- def each_index
79
- @assemblys.each_index do |i|
80
- yield i
81
- end
82
- end
63
+ def each_index
64
+ @assemblys.each_index do |i|
65
+ yield i
66
+ end
67
+ end
83
68
 
84
- def empty?
85
- @assemblys.empty?
86
- end
69
+ def empty?
70
+ @assemblys.empty?
71
+ end
87
72
 
88
- def lookup(assemblys)
89
- lookup_by = nil
90
- if assemblys.kind_of?(Megam::Assembly)
91
- lookup_by = assemblys.name
92
- elsif assemblys.kind_of?(String)
93
- lookup_by = assemblys
94
- else
95
- raise ArgumentError, "Must pass a Megam::Assemblies or String to lookup"
96
- end
97
- res = @assemblys_by_name[lookup_by]
98
- unless res
99
- raise ArgumentError, "Cannot find a node matching #{lookup_by} (did you define it first?)"
100
- end
101
- @assemblys[res]
102
- end
73
+ def lookup(assemblys)
74
+ lookup_by = nil
75
+ if assemblys.kind_of?(Megam::Assembly)
76
+ lookup_by = assemblys.name
77
+ elsif assemblys.kind_of?(String)
78
+ lookup_by = assemblys
79
+ else
80
+ raise ArgumentError, "Must pass a Megam::Assemblies or String to lookup"
81
+ end
82
+ res = @assemblys_by_name[lookup_by]
83
+ unless res
84
+ raise ArgumentError, "Cannot find a node matching #{lookup_by} (did you define it first?)"
85
+ end
86
+ @assemblys[res]
87
+ end
103
88
 
104
- def to_s
105
- @assemblys.join(", ")
106
- end
89
+ def to_s
90
+ @assemblys.join(", ")
91
+ end
107
92
 
108
- def for_json
109
- to_a.map { |item| item.to_s }
110
- end
93
+ def for_json
94
+ to_a.map { |item| item.to_s }
95
+ end
111
96
 
112
- def to_json(*a)
113
- Megam::JSONCompat.to_json(for_json, *a)
114
- end
97
+ def to_json(*a)
98
+ Megam::JSONCompat.to_json(for_json, *a)
99
+ end
115
100
 
116
- def self.json_create(o)
117
- collection = self.new()
118
- o["results"].each do |assemblys_list|
119
- assemblys_array = assemblys_list.kind_of?(Array) ? assemblys_list : [ assemblys_list ]
120
- assemblys_array.each do |assemblys|
121
- collection.insert(assemblys)
101
+ def self.json_create(o)
102
+ collection = self.new()
103
+ o["results"].each do |assemblys_list|
104
+ assemblys_array = assemblys_list.kind_of?(Array) ? assemblys_list : [ assemblys_list ]
105
+ assemblys_array.each do |assemblys|
106
+ collection.insert(assemblys)
122
107
 
108
+ end
109
+ end
110
+ collection
123
111
  end
124
- end
125
- collection
126
- end
127
112
 
128
- private
113
+ private
129
114
 
130
- def is_megam_assemblys(arg)
131
- unless arg.kind_of?(Megam::Assembly)
132
- raise ArgumentError, "Members must be Megam::Assembly's"
133
- end
134
- true
115
+ def is_megam_assemblys(arg)
116
+ unless arg.kind_of?(Megam::Assembly)
117
+ raise ArgumentError, "Members must be Megam::Assembly's"
118
+ end
119
+ true
120
+ end
135
121
  end
136
- end
137
122
  end
@@ -1,201 +1,186 @@
1
- ##
2
- ## Copyright 2013-2016 Megam Systems
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
- ##
16
1
  module Megam
17
- class Balances < Megam::RestAdapter
18
- def initialize(o)
19
- @id = nil
20
- @accounts_id = nil
21
- @name = nil
22
- @credit = nil
23
- @created_at = nil
24
- @updated_at = nil
25
- @some_msg = {}
26
- super(o)
27
- end
28
-
29
- def balances
30
- self
31
- end
32
-
33
- def id(arg=nil)
34
- if arg != nil
35
- @id = arg
36
- else
37
- @id
38
- end
39
- end
40
-
41
- def accounts_id(arg=nil)
42
- if arg != nil
43
- @accounts_id= arg
44
- else
45
- @accounts_id
46
- end
47
- end
48
-
49
- def name(arg=nil)
50
- if arg != nil
51
- @name = arg
52
- else
53
- @name
54
- end
55
- end
56
-
57
- def credit(arg=nil)
58
- if arg != nil
59
- @credit = arg
60
- else
61
- @credit
62
- end
63
- end
64
-
65
- def created_at(arg=nil)
66
- if arg != nil
67
- @created_at = arg
68
- else
69
- @created_at
70
- end
71
- end
72
-
73
- def updated_at(arg=nil)
74
- if arg != nil
75
- @updated_at = arg
76
- else
77
- @updated_at
78
- end
79
- end
80
-
81
- def some_msg(arg=nil)
82
- if arg != nil
83
- @some_msg = arg
84
- else
85
- @some_msg
86
- end
87
- end
88
-
89
- def error?
90
- crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
91
- end
92
-
93
- # Transform the ruby obj -> to a Hash
94
- def to_hash
95
- index_hash = Hash.new
96
- index_hash["json_claz"] = self.class.name
97
- index_hash["id"] = id
98
- index_hash["accounts_id"] = accounts_id
99
- index_hash["name"] = name
100
- index_hash["credit"] = credit
101
- index_hash["created_at"] = created_at
102
- index_hash["updated_at"] = updated_at
103
- index_hash
104
- end
105
-
106
- # Serialize this object as a hash: called from JsonCompat.
107
- # Verify if this called from JsonCompat during testing.
108
- def to_json(*a)
109
- for_json.to_json(*a)
110
- end
2
+ class Balances < Megam::RestAdapter
3
+ def initialize(o)
4
+ @id = nil
5
+ @accounts_id = nil
6
+ @name = nil
7
+ @credit = nil
8
+ @created_at = nil
9
+ @updated_at = nil
10
+ @some_msg = {}
11
+ super(o)
12
+ end
13
+
14
+ def balances
15
+ self
16
+ end
17
+
18
+ def id(arg=nil)
19
+ if arg != nil
20
+ @id = arg
21
+ else
22
+ @id
23
+ end
24
+ end
25
+
26
+ def accounts_id(arg=nil)
27
+ if arg != nil
28
+ @accounts_id= arg
29
+ else
30
+ @accounts_id
31
+ end
32
+ end
33
+
34
+ def name(arg=nil)
35
+ if arg != nil
36
+ @name = arg
37
+ else
38
+ @name
39
+ end
40
+ end
41
+
42
+ def credit(arg=nil)
43
+ if arg != nil
44
+ @credit = arg
45
+ else
46
+ @credit
47
+ end
48
+ end
49
+
50
+ def created_at(arg=nil)
51
+ if arg != nil
52
+ @created_at = arg
53
+ else
54
+ @created_at
55
+ end
56
+ end
57
+
58
+ def updated_at(arg=nil)
59
+ if arg != nil
60
+ @updated_at = arg
61
+ else
62
+ @updated_at
63
+ end
64
+ end
65
+
66
+ def some_msg(arg=nil)
67
+ if arg != nil
68
+ @some_msg = arg
69
+ else
70
+ @some_msg
71
+ end
72
+ end
73
+
74
+ def error?
75
+ crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
76
+ end
77
+
78
+ # Transform the ruby obj -> to a Hash
79
+ def to_hash
80
+ index_hash = Hash.new
81
+ index_hash["json_claz"] = self.class.name
82
+ index_hash["id"] = id
83
+ index_hash["accounts_id"] = accounts_id
84
+ index_hash["name"] = name
85
+ index_hash["credit"] = credit
86
+ index_hash["created_at"] = created_at
87
+ index_hash["updated_at"] = updated_at
88
+ index_hash
89
+ end
90
+
91
+ # Serialize this object as a hash: called from JsonCompat.
92
+ # Verify if this called from JsonCompat during testing.
93
+ def to_json(*a)
94
+ for_json.to_json(*a)
95
+ end
96
+
97
+ def for_json
98
+ result = {
99
+ "id" => id,
100
+ "accounts_id" => accounts_id,
101
+ "name" => name,
102
+ "credit" => credit,
103
+ "created_at" => created_at,
104
+ "updated_at" => updated_at
105
+ }
106
+ result
107
+ end
108
+
109
+ def self.json_create(o)
110
+ balances = new({})
111
+ balances.id(o["id"]) if o.has_key?("id")
112
+ balances.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
113
+ balances.name(o["name"]) if o.has_key?("name")
114
+ balances.credit(o["credit"]) if o.has_key?("credit")
115
+ balances.created_at(o["created_at"]) if o.has_key?("created_at")
116
+ balances.updated_at(o["updated_at"]) if o.has_key?("updated_at")
117
+ #success or error
118
+ balances.some_msg[:code] = o["code"] if o.has_key?("code")
119
+ balances.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
120
+ balances.some_msg[:msg]= o["msg"] if o.has_key?("msg")
121
+ balances.some_msg[:links] = o["links"] if o.has_key?("links")
122
+ balances
123
+ end
124
+
125
+ def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
126
+ balances = self.new(tmp_email, tmp_api_key, tmp_host)
127
+ balances.from_hash(o)
128
+ balances
129
+ end
130
+
131
+ def from_hash(o)
132
+ @id = o[:id] if o.has_key?(:id)
133
+ @accounts_id = o[:accounts_id] if o.has_key?(:accounts_id)
134
+ @name = o[:name] if o.has_key?(:name)
135
+ @credit = o[:credit] if o.has_key?(:credit)
136
+ @created_at = o[:created_at] if o.has_key?(:created_at)
137
+ @updated_at = o[:updated_at] if o.has_key?(:updated_at)
138
+ self
139
+ end
140
+
141
+ def self.create(params)
142
+ acct = from_hash(params,params["email"], params["api_key"], params["host"])
143
+ acct.create
144
+ end
145
+
146
+ # Create the predef via the REST API
147
+ def create
148
+ megam_rest.post_balances(to_hash)
149
+ end
150
+
151
+ # Load all balances -
152
+ # returns a BalanceCollection
153
+ # don't return self. check if the Megam::BalanceCollection is returned.
154
+ def self.list(params)
155
+ balance = self.new(params["email"], params["api_key"], params["host"])
156
+ balance.megam_rest.get_balances
157
+ end
158
+
159
+ # Show a particular balance by name,
160
+ # Megam::Balance
161
+ def self.show(params)
162
+ pre = self.new(params["email"], params["api_key"], params["host"])
163
+ pre.megam_rest.get_balance(params["email"])
164
+ end
165
+
166
+ def self.delete(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
167
+ pre = self.new(tmp_email,tmp_api_key,tmp_host)
168
+ pre.megam_rest.delete_balance(p_name)
169
+ end
170
+
171
+ def self.update(params)
172
+ asm = from_hash(params, params["email"], params["api_key"], params["host"])
173
+ asm.update
174
+ end
175
+
176
+ # Create the node via the REST API
177
+ def update
178
+ megam_rest.update_balance(to_hash)
179
+ end
180
+
181
+ def to_s
182
+ Megam::Stuff.styled_hash(to_hash)
183
+ end
111
184
 
112
- def for_json
113
- result = {
114
- "id" => id,
115
- "accounts_id" => accounts_id,
116
- "name" => name,
117
- "credit" => credit,
118
- "created_at" => created_at,
119
- "updated_at" => updated_at
120
- }
121
- result
122
185
  end
123
-
124
- def self.json_create(o)
125
- balances = new({})
126
- balances.id(o["id"]) if o.has_key?("id")
127
- balances.accounts_id(o["accounts_id"]) if o.has_key?("accounts_id")
128
- balances.name(o["name"]) if o.has_key?("name")
129
- balances.credit(o["credit"]) if o.has_key?("credit")
130
- balances.created_at(o["created_at"]) if o.has_key?("created_at")
131
- balances.updated_at(o["updated_at"]) if o.has_key?("updated_at")
132
- #success or error
133
- balances.some_msg[:code] = o["code"] if o.has_key?("code")
134
- balances.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
135
- balances.some_msg[:msg]= o["msg"] if o.has_key?("msg")
136
- balances.some_msg[:links] = o["links"] if o.has_key?("links")
137
- balances
138
- end
139
-
140
- def self.from_hash(o,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
141
- balances = self.new(tmp_email, tmp_api_key, tmp_host)
142
- balances.from_hash(o)
143
- balances
144
- end
145
-
146
- def from_hash(o)
147
- @id = o[:id] if o.has_key?(:id)
148
- @accounts_id = o[:accounts_id] if o.has_key?(:accounts_id)
149
- @name = o[:name] if o.has_key?(:name)
150
- @credit = o[:credit] if o.has_key?(:credit)
151
- @created_at = o[:created_at] if o.has_key?(:created_at)
152
- @updated_at = o[:updated_at] if o.has_key?(:updated_at)
153
- self
154
- end
155
-
156
- def self.create(params)
157
- acct = from_hash(params,params["email"], params["api_key"], params["host"])
158
- acct.create
159
- end
160
-
161
- # Create the predef via the REST API
162
- def create
163
- megam_rest.post_balances(to_hash)
164
- end
165
-
166
- # Load all balances -
167
- # returns a BalanceCollection
168
- # don't return self. check if the Megam::BalanceCollection is returned.
169
- def self.list(params)
170
- balance = self.new(params["email"], params["api_key"], params["host"])
171
- balance.megam_rest.get_balances
172
- end
173
-
174
- # Show a particular balance by name,
175
- # Megam::Balance
176
- def self.show(params)
177
- pre = self.new(params["email"], params["api_key"], params["host"])
178
- pre.megam_rest.get_balance(params["email"])
179
- end
180
-
181
- def self.delete(p_name,tmp_email=nil, tmp_api_key=nil, tmp_host=nil)
182
- pre = self.new(tmp_email,tmp_api_key,tmp_host)
183
- pre.megam_rest.delete_balance(p_name)
184
- end
185
-
186
- def self.update(params)
187
- asm = from_hash(params, params["email"], params["api_key"], params["host"])
188
- asm.update
189
- end
190
-
191
- # Create the node via the REST API
192
- def update
193
- megam_rest.update_balance(to_hash)
194
- end
195
-
196
- def to_s
197
- Megam::Stuff.styled_hash(to_hash)
198
- end
199
-
200
- end
201
186
  end