runcible / lib / runcible / models / export_distributor.rb @ c0df0f4c
1 |
require 'active_support/json'
|
---|---|
2 |
require 'securerandom'
|
3 |
|
4 |
module Runcible |
5 |
module Models |
6 |
class ExportDistributor < Distributor |
7 |
#required attributes
|
8 |
attr_accessor 'http', 'https', 'relative_url' |
9 |
|
10 |
# Instantiates a export distributor
|
11 |
#
|
12 |
# @param [boolean] http serve the contents over http
|
13 |
# @param [boolean] https serve the contents over https
|
14 |
# @param [string] relative_url relative url (aka relative path)
|
15 |
# @return [Runcible::Extensions::ExportDistributor]
|
16 |
def initialize(http, https, relative_url = nil) |
17 |
@http = http
|
18 |
@https = https
|
19 |
@relative_url = relative_url
|
20 |
# Pulp seems to expect the ID to be export_distributor, not a random
|
21 |
super({:id => type_id}) |
22 |
end
|
23 |
|
24 |
# Distributor Type id
|
25 |
#
|
26 |
# @return [string]
|
27 |
def self.type_id |
28 |
'export_distributor'
|
29 |
end
|
30 |
|
31 |
# generate the pulp config for the export distributor
|
32 |
#
|
33 |
# @return [Hash]
|
34 |
def config |
35 |
to_ret = as_json |
36 |
to_ret.delete('auto_publish')
|
37 |
to_ret.delete('id')
|
38 |
to_ret |
39 |
end
|
40 |
end
|
41 |
end
|
42 |
end
|