Project

General

Profile

Download (1.03 KB) Statistics
| Branch: | Tag: | Revision:

runcible / lib / runcible / models / iso_distributor.rb @ c0df0f4c

1
require 'active_support/json'
2
require 'securerandom'
3

    
4
module Runcible
5
  module Models
6
    class IsoDistributor < Distributor
7
      #required attributes
8
      attr_accessor 'relative_url', 'serve_http', 'serve_https'
9

    
10
      # Instantiates an iso distributor
11
      #
12
      # @param  [path]            relative URL
13
      # @param  [boolean]         http  serve the contents over http
14
      # @param  [boolean]         https serve the contents over https
15
      # @return [Runcible::Extensions::IsoDistributor]
16
      def initialize(relative_url, http, https, options = {})
17
        @relative_url = relative_url
18
        @serve_http = http
19
        @serve_https = https
20
        super(options)
21
      end
22

    
23
      # Distributor Type id
24
      #
25
      # @return [string]
26
      def self.type_id
27
        'iso_distributor'
28
      end
29

    
30
      # generate the pulp config for the iso distributor
31
      #
32
      # @return [Hash]
33
      def config
34
        to_ret = as_json
35
        to_ret.delete('auto_publish')
36
        to_ret.delete('id')
37
        to_ret
38
      end
39
    end
40
  end
41
end