runcible / lib / runcible / models / group_export_distributor.rb @ c0df0f4c
1 |
require 'active_support/json'
|
---|---|
2 |
require 'securerandom'
|
3 |
|
4 |
module Runcible |
5 |
module Models |
6 |
class GroupExportDistributor < Distributor |
7 |
#required attributes
|
8 |
attr_accessor 'http', 'https' |
9 |
|
10 |
# Instantiates a group export distributor.
|
11 |
#
|
12 |
# @param [boolean] http serve the contents over http
|
13 |
# @param [boolean] https serve the contents over https
|
14 |
# @param [hash] params additional parameters to send in request
|
15 |
# @return [Runcible::Extensions::GroupExportDistributor]
|
16 |
def initialize(http = false, https = false, params = {}) |
17 |
@http = http
|
18 |
@https = https
|
19 |
# these two fields are helpful when instantiating a group export
|
20 |
# distributor via group creation. It saves a few pulp API calls.
|
21 |
@distributor_type_id = type_id
|
22 |
@distributor_config = {:http => http, :https => https} |
23 |
super(params)
|
24 |
end
|
25 |
|
26 |
# Distributor Type id
|
27 |
#
|
28 |
# @return [string]
|
29 |
def self.type_id |
30 |
'group_export_distributor'
|
31 |
end
|
32 |
|
33 |
# generate the pulp config for the export distributor
|
34 |
#
|
35 |
# @return [Hash]
|
36 |
def config |
37 |
to_ret = as_json |
38 |
to_ret.delete('auto_publish')
|
39 |
to_ret.delete('id')
|
40 |
to_ret |
41 |
end
|
42 |
end
|
43 |
end
|
44 |
end
|