xfrtuc 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/xfrtuc.rb +15 -6
- data/lib/xfrtuc/version.rb +1 -1
- data/spec/xfrtuc_spec.rb +27 -4
- metadata +2 -2
data/Gemfile.lock
CHANGED
data/lib/xfrtuc.rb
CHANGED
@@ -100,6 +100,8 @@ module Xfrtuc
|
|
100
100
|
from_name = opts.delete :from_name
|
101
101
|
to_name = opts.delete :to_name
|
102
102
|
log_input_url = opts.delete :log_input_url
|
103
|
+
num_keep = opts.delete :num_keep
|
104
|
+
|
103
105
|
unless opts.empty?
|
104
106
|
raise ArgumentError, "Unsupported option(s): #{opts.keys}"
|
105
107
|
end
|
@@ -112,6 +114,7 @@ module Xfrtuc
|
|
112
114
|
to_name: to_name
|
113
115
|
}
|
114
116
|
payload.merge!(log_input_url: log_input_url) unless log_input_url.nil?
|
117
|
+
payload.merge!(num_keep: num_keep) unless num_keep.nil?
|
115
118
|
|
116
119
|
client.post("/transfers", payload)
|
117
120
|
end
|
@@ -146,17 +149,23 @@ module Xfrtuc
|
|
146
149
|
hour = opts.fetch :hour
|
147
150
|
days = opts.fetch(:days, Date::DAYNAMES)
|
148
151
|
timezone = opts.fetch(:timezone, 'UTC')
|
152
|
+
retain_weeks = opts.delete(:retain_weeks)
|
153
|
+
retain_months = opts.delete(:retain_months)
|
154
|
+
|
149
155
|
[ :name, :callback_url, :hour, :days, :timezone ].each { |key| opts.delete key }
|
150
156
|
unless opts.empty?
|
151
157
|
raise ArgumentError, "Unsupported option(s): #{opts.keys}"
|
152
158
|
end
|
153
159
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
+
sched_opts = { name: name,
|
161
|
+
callback_url: callback_url,
|
162
|
+
hour: hour,
|
163
|
+
days: days,
|
164
|
+
timezone: timezone }
|
165
|
+
sched_opts[:retain_weeks] = retain_weeks unless retain_weeks.nil?
|
166
|
+
sched_opts[:retain_months] = retain_months unless retain_months.nil?
|
167
|
+
|
168
|
+
client.post("/schedules", sched_opts)
|
160
169
|
end
|
161
170
|
|
162
171
|
def delete(id)
|
data/lib/xfrtuc/version.rb
CHANGED
data/spec/xfrtuc_spec.rb
CHANGED
@@ -107,9 +107,12 @@ module Xfrtuc
|
|
107
107
|
return [404, headers, []]
|
108
108
|
end
|
109
109
|
xfer = { uuid: SecureRandom.uuid }
|
110
|
-
%w(from_type from_url from_name to_type to_url to_name).each do |key|
|
110
|
+
%w(from_type from_url from_name to_type to_url to_name log_input_url).each do |key|
|
111
111
|
xfer[key.to_sym] = transfer[key]
|
112
112
|
end
|
113
|
+
if transfer.has_key? 'num_keep'
|
114
|
+
xfer[:num_keep] = transfer['num_keep']
|
115
|
+
end
|
113
116
|
|
114
117
|
@transfers[group_name] << xfer
|
115
118
|
[201, {}, [xfer.to_json]]
|
@@ -163,6 +166,9 @@ module Xfrtuc
|
|
163
166
|
%w(name callback_url days hour timezone).each do |key|
|
164
167
|
sched[key.to_sym] = schedule[key]
|
165
168
|
end
|
169
|
+
%w(retain_weeks retain_months).each do |key|
|
170
|
+
sched[key.to_sym] = schedule[key] if schedule.has_key? key
|
171
|
+
end
|
166
172
|
@schedules[group_name] << sched
|
167
173
|
[201, {}, [sched.to_json]]
|
168
174
|
end
|
@@ -476,9 +482,16 @@ module Xfrtuc
|
|
476
482
|
|
477
483
|
it "accepts an optional log_input_url" do
|
478
484
|
log_url = "https://example.com/logs"
|
479
|
-
|
480
|
-
|
481
|
-
|
485
|
+
client.group(g).transfer.create(xfer_data.merge(log_input_url: log_url))
|
486
|
+
xfer = fakesferatu.last_transfer(g)
|
487
|
+
expect(xfer[:log_input_url]).to eq(log_url)
|
488
|
+
end
|
489
|
+
|
490
|
+
it "accepts an optional num_keep" do
|
491
|
+
num_keep = 3
|
492
|
+
client.group(g).transfer.create(xfer_data.merge(num_keep: num_keep))
|
493
|
+
xfer = fakesferatu.last_transfer(g)
|
494
|
+
expect(xfer[:num_keep]).to eq(num_keep)
|
482
495
|
end
|
483
496
|
end
|
484
497
|
|
@@ -589,6 +602,16 @@ module Xfrtuc
|
|
589
602
|
expect(sched[k]).to eq(v)
|
590
603
|
end
|
591
604
|
end
|
605
|
+
|
606
|
+
it "accepts an optional retain_weeks and retain_months" do
|
607
|
+
retain_weeks = 7
|
608
|
+
retain_months = 8
|
609
|
+
client.group(g).schedule.create(sched_data.merge(retain_weeks: retain_weeks,
|
610
|
+
retain_months: retain_months))
|
611
|
+
sched = fakesferatu.last_schedule(g)
|
612
|
+
expect(sched[:retain_weeks]).to eq(retain_weeks)
|
613
|
+
expect(sched[:retain_months]).to eq(retain_months)
|
614
|
+
end
|
592
615
|
end
|
593
616
|
|
594
617
|
describe "#list" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xfrtuc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
12
|
+
date: 2015-01-30 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|