megam_api 1.10.7 → 1.10.8
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.rb +3 -0
- data/lib/megam/api/backups.rb +46 -0
- data/lib/megam/api/version.rb +1 -1
- data/lib/megam/core/backups.rb +242 -0
- data/lib/megam/core/backups_collection.rb +122 -0
- data/lib/megam/core/json_compat.rb +6 -0
- data/lib/megam/core/snapshots.rb +21 -8
- data/test/test_backups.rb +29 -0
- data/test/test_helper.rb +5 -5
- data/test/test_snapshots.rb +5 -4
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef8179eb066686dd34c028f4d6c70be11e98011e
|
4
|
+
data.tar.gz: 706e01c77f578c3cdf19afb42d037111d1deeb8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 593c248b60dc7d654e7a0e79cdae692ad306ff4c3cdb9d6be6cffd2c7703b2d4ee2b3bf9d271f39696964eb742efe46c78741423e97ee7de372c63cffeb9834a
|
7
|
+
data.tar.gz: 1596a21149c68610b9fc29d4982c64297a9f95b83b63a3eebf658397581204d6349b53a4f09b9806cf09b88c51b13327f5fd95697e38d361375aa49520bf8882
|
data/lib/megam/api.rb
CHANGED
@@ -31,6 +31,7 @@ require 'megam/api/eventscontainer'
|
|
31
31
|
require 'megam/api/eventsbilling'
|
32
32
|
require 'megam/api/eventsstorage'
|
33
33
|
require 'megam/api/snapshots'
|
34
|
+
require 'megam/api/backups'
|
34
35
|
require 'megam/api/reports'
|
35
36
|
require 'megam/api/quotas'
|
36
37
|
require 'megam/api/disks'
|
@@ -88,6 +89,8 @@ require 'megam/core/sensors'
|
|
88
89
|
require 'megam/core/sensors_collection'
|
89
90
|
require 'megam/core/snapshots'
|
90
91
|
require 'megam/core/snapshots_collection'
|
92
|
+
require 'megam/core/backups'
|
93
|
+
require 'megam/core/backups_collection'
|
91
94
|
require 'megam/core/reports'
|
92
95
|
require 'megam/core/reports_collection'
|
93
96
|
require 'megam/core/quotas'
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module Megam
|
2
|
+
class API
|
3
|
+
# GET /nodes
|
4
|
+
def list_backups
|
5
|
+
@options = {:path => "/backups",:body => ""}.merge(@options)
|
6
|
+
|
7
|
+
request(
|
8
|
+
:expects => 200,
|
9
|
+
:method => :get,
|
10
|
+
:body => @options[:body]
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
def get_backups(asm_id)
|
15
|
+
@options = {:path => "/backups/#{asm_id}",:body => ""}.merge(@options)
|
16
|
+
|
17
|
+
request(
|
18
|
+
:expects => 200,
|
19
|
+
:method => :get,
|
20
|
+
:body => @options[:body]
|
21
|
+
)
|
22
|
+
end
|
23
|
+
def post_backups(new_sps)
|
24
|
+
@options = {:path => '/backups/content',
|
25
|
+
:body => Megam::JSONCompat.to_json(new_sps)}.merge(@options)
|
26
|
+
|
27
|
+
request(
|
28
|
+
:expects => 201,
|
29
|
+
:method => :post,
|
30
|
+
:body => @options[:body]
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def update_backups(update_sps)
|
35
|
+
@options = {:path => '/backups/update',
|
36
|
+
:body => Megam::JSONCompat.to_json(update_sps)}.merge(@options)
|
37
|
+
|
38
|
+
request(
|
39
|
+
:expects => 201,
|
40
|
+
:method => :post,
|
41
|
+
:body => @options[:body]
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
data/lib/megam/api/version.rb
CHANGED
@@ -0,0 +1,242 @@
|
|
1
|
+
module Megam
|
2
|
+
class Backups < Megam::RestAdapter
|
3
|
+
def initialize(o)
|
4
|
+
@id = nil
|
5
|
+
@account_id = nil
|
6
|
+
@asm_id = nil
|
7
|
+
@org_id = nil
|
8
|
+
@tosca_type = nil
|
9
|
+
@inputs = []
|
10
|
+
@outputs = []
|
11
|
+
@name= nil
|
12
|
+
@status=nil
|
13
|
+
@image_id=nil
|
14
|
+
@created_at = nil
|
15
|
+
@some_msg = {}
|
16
|
+
super(o)
|
17
|
+
end
|
18
|
+
|
19
|
+
def backups
|
20
|
+
self
|
21
|
+
end
|
22
|
+
def id(arg=nil)
|
23
|
+
if arg != nil
|
24
|
+
@id = arg
|
25
|
+
else
|
26
|
+
@id
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def account_id(arg=nil)
|
31
|
+
if arg != nil
|
32
|
+
@account_id = arg
|
33
|
+
else
|
34
|
+
@account_id
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def asm_id(arg=nil)
|
39
|
+
if arg != nil
|
40
|
+
@asm_id = arg
|
41
|
+
else
|
42
|
+
@asm_id
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def org_id(arg=nil)
|
47
|
+
if arg != nil
|
48
|
+
@org_id = arg
|
49
|
+
else
|
50
|
+
@org_id
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def tosca_type(arg = nil)
|
55
|
+
if !arg.nil?
|
56
|
+
@tosca_type = arg
|
57
|
+
else
|
58
|
+
@tosca_type
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def inputs(arg = [])
|
63
|
+
if arg != []
|
64
|
+
@inputs = arg
|
65
|
+
else
|
66
|
+
@inputs
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def outputs(arg = [])
|
71
|
+
if arg != []
|
72
|
+
@outputs = arg
|
73
|
+
else
|
74
|
+
@outputs
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def name(arg=nil)
|
79
|
+
if arg != nil
|
80
|
+
@name = arg
|
81
|
+
else
|
82
|
+
@name
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def status(arg=nil)
|
87
|
+
if arg != nil
|
88
|
+
@status = arg
|
89
|
+
else
|
90
|
+
@status
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def image_id(arg=nil)
|
95
|
+
if arg != nil
|
96
|
+
@image_id = arg
|
97
|
+
else
|
98
|
+
@image_id
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def created_at(arg=nil)
|
103
|
+
if arg != nil
|
104
|
+
@created_at = arg
|
105
|
+
else
|
106
|
+
@created_at
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def error?
|
111
|
+
crocked = true if (some_msg.has_key?(:msg_type) && some_msg[:msg_type] == "error")
|
112
|
+
end
|
113
|
+
|
114
|
+
|
115
|
+
def some_msg(arg=nil)
|
116
|
+
if arg != nil
|
117
|
+
@some_msg = arg
|
118
|
+
else
|
119
|
+
@some_msg
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
# Transform the ruby obj -> to a Hash
|
125
|
+
def to_hash
|
126
|
+
index_hash = Hash.new
|
127
|
+
index_hash["json_claz"] = self.class.name
|
128
|
+
index_hash["id"] = id
|
129
|
+
index_hash["account_id"] = account_id
|
130
|
+
index_hash["asm_id"] = asm_id
|
131
|
+
index_hash["org_id"] = org_id
|
132
|
+
index_hash["tosca_type"] = tosca_type
|
133
|
+
index_hash["inputs"] = inputs
|
134
|
+
index_hash["outputs"] = outputs
|
135
|
+
index_hash["name"] = name
|
136
|
+
index_hash["status"] = status
|
137
|
+
index_hash["image_id"] = image_id
|
138
|
+
index_hash["created_at"] = created_at
|
139
|
+
index_hash["some_msg"] = some_msg
|
140
|
+
index_hash
|
141
|
+
end
|
142
|
+
|
143
|
+
# Serialize this object as a hash: called from JsonCompat.
|
144
|
+
# Verify if this called from JsonCompat during testing.
|
145
|
+
def to_json(*a)
|
146
|
+
for_json.to_json(*a)
|
147
|
+
end
|
148
|
+
|
149
|
+
def for_json
|
150
|
+
result = {
|
151
|
+
"id" => id,
|
152
|
+
"account_id" => account_id,
|
153
|
+
"asm_id" => asm_id,
|
154
|
+
"org_id" => org_id,
|
155
|
+
"tosca_type" => tosca_type,
|
156
|
+
"inputs" => inputs,
|
157
|
+
"outputs" => outputs,
|
158
|
+
"name" => name,
|
159
|
+
"status" => status,
|
160
|
+
"image_id" => image_id,
|
161
|
+
"created_at" => created_at
|
162
|
+
}
|
163
|
+
result
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.json_create(o)
|
167
|
+
sps = new({})
|
168
|
+
sps.id(o["id"]) if o.has_key?("id")
|
169
|
+
sps.account_id(o["account_id"]) if o.has_key?("account_id")
|
170
|
+
sps.asm_id(o["asm_id"]) if o.has_key?("asm_id")
|
171
|
+
sps.org_id(o["org_id"]) if o.has_key?("org_id") #this will be an array? can hash store array?
|
172
|
+
sps.tosca_type(o['tosca_type']) if o.key?('tosca_type')
|
173
|
+
sps.inputs(o['inputs']) if o.key?('inputs')
|
174
|
+
sps.outputs(o['outputs']) if o.key?('outputs')
|
175
|
+
sps.name(o["name"]) if o.has_key?("name")
|
176
|
+
sps.status(o["status"]) if o.has_key?("status")
|
177
|
+
sps.image_id(o["image_id"]) if o.has_key?("image_id")
|
178
|
+
sps.created_at(o["created_at"]) if o.has_key?("created_at")
|
179
|
+
sps.some_msg[:code] = o["code"] if o.has_key?("code")
|
180
|
+
sps.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
181
|
+
sps.some_msg[:msg]= o["msg"] if o.has_key?("msg")
|
182
|
+
sps.some_msg[:links] = o["links"] if o.has_key?("links")
|
183
|
+
sps
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.from_hash(o)
|
187
|
+
sps = self.new(o)
|
188
|
+
sps.from_hash(o)
|
189
|
+
sps
|
190
|
+
end
|
191
|
+
|
192
|
+
def from_hash(o)
|
193
|
+
@id = o[:id] if o.has_key?(:id)
|
194
|
+
@account_id = o[:account_id] if o.has_key?(:account_id)
|
195
|
+
@asm_id = o[:asm_id] if o.has_key?(:asm_id)
|
196
|
+
@org_id = o[:org_id] if o.has_key?(:org_id)
|
197
|
+
@tosca_type = o[:tosca_type] if o.key?(:tosca_type)
|
198
|
+
@inputs = o[:inputs] if o.key?(:inputs)
|
199
|
+
@outputs = o[:outputs] if o.key?(:outputs)
|
200
|
+
@name = o[:name] if o.has_key?(:name)
|
201
|
+
@status = o[:status] if o.has_key?(:status)
|
202
|
+
@image_id = o[:image_id] if o.has_key?(:image_id)
|
203
|
+
@created_at = o[:created_at] if o.has_key?(:created_at)
|
204
|
+
self
|
205
|
+
end
|
206
|
+
|
207
|
+
def self.create(params)
|
208
|
+
sps = from_hash(params)
|
209
|
+
sps.create
|
210
|
+
end
|
211
|
+
|
212
|
+
def self.update(params)
|
213
|
+
sps = from_hash(params)
|
214
|
+
sps.update
|
215
|
+
end
|
216
|
+
|
217
|
+
# Create the node via the REST API
|
218
|
+
def create
|
219
|
+
megam_rest.post_backups(to_hash)
|
220
|
+
end
|
221
|
+
|
222
|
+
# Load a account by email_p
|
223
|
+
def self.show(o)
|
224
|
+
sps = self.new(o)
|
225
|
+
sps.megam_rest.get_backups(o[:id])
|
226
|
+
end
|
227
|
+
|
228
|
+
def self.list(params)
|
229
|
+
sps = self.new(params)
|
230
|
+
sps.megam_rest.list_backups
|
231
|
+
end
|
232
|
+
|
233
|
+
def update
|
234
|
+
megam_rest.update_backups(to_hash)
|
235
|
+
end
|
236
|
+
|
237
|
+
def to_s
|
238
|
+
Megam::Stuff.styled_hash(to_hash)
|
239
|
+
end
|
240
|
+
|
241
|
+
end
|
242
|
+
end
|
@@ -0,0 +1,122 @@
|
|
1
|
+
module Megam
|
2
|
+
class BackupsCollection
|
3
|
+
include Enumerable
|
4
|
+
|
5
|
+
attr_reader :iterator
|
6
|
+
def initialize
|
7
|
+
@backups = Array.new
|
8
|
+
@backups_by_name = Hash.new
|
9
|
+
@insert_after_idx = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
def all_backups
|
13
|
+
@backups
|
14
|
+
end
|
15
|
+
|
16
|
+
def [](index)
|
17
|
+
@backups[index]
|
18
|
+
end
|
19
|
+
|
20
|
+
def []=(index, arg)
|
21
|
+
is_megam_backups(arg)
|
22
|
+
@backups[index] = arg
|
23
|
+
@backups_by_name[arg.account_id] = index
|
24
|
+
end
|
25
|
+
|
26
|
+
def <<(*args)
|
27
|
+
args.flatten.each do |a|
|
28
|
+
is_megam_backups(a)
|
29
|
+
@backups << a
|
30
|
+
@backups_by_name[a.account_id] = @backups.length - 1
|
31
|
+
end
|
32
|
+
self
|
33
|
+
end
|
34
|
+
|
35
|
+
# 'push' is an alias method to <<
|
36
|
+
alias_method :push, :<<
|
37
|
+
|
38
|
+
def insert(backups)
|
39
|
+
is_megam_backups(backups)
|
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
|
+
@backups.insert(@insert_after_idx + 1, backups)
|
45
|
+
# update name -> location mappings and register new node
|
46
|
+
@backups_by_name.each_key do |key|
|
47
|
+
@backups_by_name[key] += 1 if @backups_by_name[key] > @insert_after_idx
|
48
|
+
end
|
49
|
+
@backups_by_name[backups.account_id] = @insert_after_idx + 1
|
50
|
+
@insert_after_idx += 1
|
51
|
+
else
|
52
|
+
@backups << backups
|
53
|
+
@backups_by_name[backups.account_id] = @backups.length - 1
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def each
|
58
|
+
@backups.each do |backups|
|
59
|
+
yield backups
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def each_index
|
64
|
+
@backups.each_index do |i|
|
65
|
+
yield i
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def empty?
|
70
|
+
@backups.empty?
|
71
|
+
end
|
72
|
+
|
73
|
+
def lookup(backups)
|
74
|
+
lookup_by = nil
|
75
|
+
if events.kind_of?(Megam::Backups)
|
76
|
+
lookup_by = backups.account_id
|
77
|
+
elsif backups.kind_of?(String)
|
78
|
+
lookup_by = backups
|
79
|
+
else
|
80
|
+
raise ArgumentError, "Must pass a Megam::Backups or String to lookup"
|
81
|
+
end
|
82
|
+
res = @backups_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
|
+
@backups[res]
|
87
|
+
end
|
88
|
+
|
89
|
+
def to_s
|
90
|
+
@backups.join(", ")
|
91
|
+
end
|
92
|
+
|
93
|
+
def for_json
|
94
|
+
to_a.map { |item| item.to_s }
|
95
|
+
end
|
96
|
+
|
97
|
+
def to_json(*a)
|
98
|
+
Megam::JSONCompat.to_json(for_json, *a)
|
99
|
+
end
|
100
|
+
|
101
|
+
def self.json_create(o)
|
102
|
+
collection = self.new()
|
103
|
+
o["results"].each do |backups_list|
|
104
|
+
backups_array = backups_list.kind_of?(Array) ? backups_list : [ backups_list ]
|
105
|
+
backups_array.each do |backups|
|
106
|
+
collection.insert(backups)
|
107
|
+
|
108
|
+
end
|
109
|
+
end
|
110
|
+
collection
|
111
|
+
end
|
112
|
+
|
113
|
+
private
|
114
|
+
|
115
|
+
def is_megam_backups(arg)
|
116
|
+
unless arg.kind_of?(Megam::Backups)
|
117
|
+
raise ArgumentError, "Members must be Megam::Backups's"
|
118
|
+
end
|
119
|
+
true
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
@@ -40,6 +40,8 @@ module Megam
|
|
40
40
|
MEGAM_SENSORSCOLLECTION = 'Megam::SensorsCollection'.freeze
|
41
41
|
MEGAM_SNAPSHOTS = 'Megam::Snapshots'.freeze
|
42
42
|
MEGAM_SNAPSHOTSCOLLECTION = 'Megam::SnapshotsCollection'.freeze
|
43
|
+
MEGAM_BACKUPS = 'Megam::Backups'.freeze
|
44
|
+
MEGAM_BACKUPSCOLLECTION = 'Megam::BackupsCollection'.freeze
|
43
45
|
MEGAM_DISKS = 'Megam::Disks'.freeze
|
44
46
|
MEGAM_DISKSCOLLECTION = 'Megam::DisksCollection'.freeze
|
45
47
|
MEGAM_LICENSE = 'Megam::License'.freeze
|
@@ -218,6 +220,10 @@ module Megam
|
|
218
220
|
Megam::Snapshots
|
219
221
|
when MEGAM_SNAPSHOTSCOLLECTION
|
220
222
|
Megam::SnapshotsCollection
|
223
|
+
when MEGAM_BACKUPS
|
224
|
+
Megam::Backups
|
225
|
+
when MEGAM_BACKUPSCOLLECTION
|
226
|
+
Megam::BackupsCollection
|
221
227
|
when MEGAM_BALANCES
|
222
228
|
Megam::Balances
|
223
229
|
when MEGAM_BALANCESCOLLECTION
|
data/lib/megam/core/snapshots.rb
CHANGED
@@ -10,7 +10,8 @@ module Megam
|
|
10
10
|
@outputs = []
|
11
11
|
@name= nil
|
12
12
|
@status=nil
|
13
|
-
@
|
13
|
+
@disk_id=nil
|
14
|
+
@snap_id=nil
|
14
15
|
@created_at = nil
|
15
16
|
@some_msg = {}
|
16
17
|
super(o)
|
@@ -91,11 +92,19 @@ module Megam
|
|
91
92
|
end
|
92
93
|
end
|
93
94
|
|
94
|
-
def
|
95
|
+
def disk_id(arg=nil)
|
95
96
|
if arg != nil
|
96
|
-
@
|
97
|
+
@disk_id = arg
|
97
98
|
else
|
98
|
-
@
|
99
|
+
@disk_id
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def snap_id(arg=nil)
|
104
|
+
if arg != nil
|
105
|
+
@snap_id = arg
|
106
|
+
else
|
107
|
+
@snap_id
|
99
108
|
end
|
100
109
|
end
|
101
110
|
|
@@ -134,7 +143,8 @@ module Megam
|
|
134
143
|
index_hash["outputs"] = outputs
|
135
144
|
index_hash["name"] = name
|
136
145
|
index_hash["status"] = status
|
137
|
-
index_hash["
|
146
|
+
index_hash["disk_id"] = disk_id
|
147
|
+
index_hash["snap_id"] = snap_id
|
138
148
|
index_hash["created_at"] = created_at
|
139
149
|
index_hash["some_msg"] = some_msg
|
140
150
|
index_hash
|
@@ -157,7 +167,8 @@ module Megam
|
|
157
167
|
"outputs" => outputs,
|
158
168
|
"name" => name,
|
159
169
|
"status" => status,
|
160
|
-
"
|
170
|
+
"disk_id" => disk_id,
|
171
|
+
"snap_id" => snap_id,
|
161
172
|
"created_at" => created_at
|
162
173
|
}
|
163
174
|
result
|
@@ -174,7 +185,8 @@ module Megam
|
|
174
185
|
sps.outputs(o['outputs']) if o.key?('outputs')
|
175
186
|
sps.name(o["name"]) if o.has_key?("name")
|
176
187
|
sps.status(o["status"]) if o.has_key?("status")
|
177
|
-
sps.
|
188
|
+
sps.disk_id(o["disk_id"]) if o.has_key?("disk_id")
|
189
|
+
sps.snap_id(o["snap_id"]) if o.has_key?("snap_id")
|
178
190
|
sps.created_at(o["created_at"]) if o.has_key?("created_at")
|
179
191
|
sps.some_msg[:code] = o["code"] if o.has_key?("code")
|
180
192
|
sps.some_msg[:msg_type] = o["msg_type"] if o.has_key?("msg_type")
|
@@ -199,7 +211,8 @@ module Megam
|
|
199
211
|
@outputs = o[:outputs] if o.key?(:outputs)
|
200
212
|
@name = o[:name] if o.has_key?(:name)
|
201
213
|
@status = o[:status] if o.has_key?(:status)
|
202
|
-
@
|
214
|
+
@disk_id = o[:disk_id] if o.has_key?(:disk_id)
|
215
|
+
@snap_id = o[:snap_id] if o.has_key?(:snap_id)
|
203
216
|
@created_at = o[:created_at] if o.has_key?(:created_at)
|
204
217
|
self
|
205
218
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.expand_path("#{File.dirname(__FILE__)}/test_helper")
|
2
|
+
|
3
|
+
class TestApps < MiniTest::Unit::TestCase
|
4
|
+
|
5
|
+
def test_post_backups
|
6
|
+
tmp_hash = {
|
7
|
+
:account_id => "test@megam.io",
|
8
|
+
:asm_id => "ASM53557642376448623",
|
9
|
+
:org_id => "ORG787966332632133788",
|
10
|
+
:name => "pop.megambox.com",
|
11
|
+
:status => "progress",
|
12
|
+
:tosca_type => "torpedo",
|
13
|
+
}
|
14
|
+
|
15
|
+
response = megams.post_backups(tmp_hash)
|
16
|
+
assert_equal(201, response.status)
|
17
|
+
end
|
18
|
+
#=begin
|
19
|
+
def test_get_backups
|
20
|
+
response = megams.get_backups("ASM535576423764486230")
|
21
|
+
assert_equal(200, response.status)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_list_backups
|
25
|
+
response = megams.list_backups
|
26
|
+
assert_equal(200, response.status)
|
27
|
+
end
|
28
|
+
#=end
|
29
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -20,8 +20,8 @@ end
|
|
20
20
|
|
21
21
|
def megams_new(options={})
|
22
22
|
s_options = SANDBOX_HOST_OPTIONS.merge({
|
23
|
-
|
24
|
-
|
23
|
+
:email => "cd@ss.co",
|
24
|
+
:api_key => "1189a21d8965ee670536cbb61fd9f5afed8489c0",
|
25
25
|
})
|
26
26
|
options = s_options.merge(options)
|
27
27
|
mg=Megam::API.new(options)
|
@@ -29,9 +29,9 @@ end
|
|
29
29
|
|
30
30
|
def megams(options={})
|
31
31
|
s_options = SANDBOX_HOST_OPTIONS.merge({
|
32
|
-
:email => "
|
33
|
-
:api_key => "
|
34
|
-
:org_id => "
|
32
|
+
:email => "cd@ss.co",
|
33
|
+
:api_key => "1189a21d8965ee670536cbb61fd9f5afed8489c0",
|
34
|
+
:org_id => "ORG8385278424580953898",
|
35
35
|
#:password => "bWVnYW0="
|
36
36
|
})
|
37
37
|
|
data/test/test_snapshots.rb
CHANGED
@@ -5,25 +5,26 @@ class TestApps < MiniTest::Unit::TestCase
|
|
5
5
|
def test_post_snapshots
|
6
6
|
tmp_hash = {
|
7
7
|
:account_id => "test@megam.io",
|
8
|
-
:asm_id => "
|
9
|
-
:org_id => "
|
8
|
+
:asm_id => "ASM53557642376448623",
|
9
|
+
:org_id => "ORG787966332632133788",
|
10
10
|
:name => "pop.megambox.com",
|
11
11
|
:status => "progress",
|
12
|
+
:tosca_type => "torpedo",
|
12
13
|
|
13
14
|
}
|
14
15
|
|
15
16
|
response = megams.post_snapshots(tmp_hash)
|
16
17
|
assert_equal(201, response.status)
|
17
18
|
end
|
19
|
+
#=begin
|
18
20
|
|
19
21
|
def test_get_snapshots
|
20
22
|
response = megams.get_snapshots("ASM535576423764486230")
|
21
23
|
assert_equal(200, response.status)
|
22
24
|
end
|
23
|
-
=begin
|
24
25
|
def test_list_snapshots
|
25
26
|
response = megams.list_snapshots
|
26
27
|
assert_equal(200, response.status)
|
27
28
|
end
|
28
|
-
|
29
|
+
#=end
|
29
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: megam_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.10.
|
4
|
+
version: 1.10.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rajthilak, Kishorekumar Neelamegam, Ranjitha R, Vinodhini V, Rathish VBR, Rajesh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: excon
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/megam/api/addons.rb
|
141
141
|
- lib/megam/api/assemblies.rb
|
142
142
|
- lib/megam/api/assembly.rb
|
143
|
+
- lib/megam/api/backups.rb
|
143
144
|
- lib/megam/api/balances.rb
|
144
145
|
- lib/megam/api/billedhistories.rb
|
145
146
|
- lib/megam/api/billingtransactions.rb
|
@@ -173,6 +174,8 @@ files:
|
|
173
174
|
- lib/megam/core/assemblies_collection.rb
|
174
175
|
- lib/megam/core/assembly.rb
|
175
176
|
- lib/megam/core/assembly_collection.rb
|
177
|
+
- lib/megam/core/backups.rb
|
178
|
+
- lib/megam/core/backups_collection.rb
|
176
179
|
- lib/megam/core/balances.rb
|
177
180
|
- lib/megam/core/balances_collection.rb
|
178
181
|
- lib/megam/core/billedhistories.rb
|
@@ -243,6 +246,7 @@ files:
|
|
243
246
|
- test/test_addons.rb
|
244
247
|
- test/test_assemblies.rb
|
245
248
|
- test/test_assembly.rb
|
249
|
+
- test/test_backups.rb
|
246
250
|
- test/test_balances.rb
|
247
251
|
- test/test_billedhistories.rb
|
248
252
|
- test/test_billingtranscations.rb
|