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