summaryrefslogtreecommitdiff
path: root/lib/gitlab/fogbugz_import/repository.rb
blob: b958dcf6cbff5b534c976b7f34f6135f17ccafa4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# frozen_string_literal: true

module Gitlab
  module FogbugzImport
    class Repository
      attr_accessor :raw_data

      def initialize(raw_data)
        @raw_data = raw_data
      end

      def valid?
        raw_data.is_a?(Hash)
      end

      def id
        raw_data['ixProject']
      end

      def name
        raw_data['sProject']
      end

      def safe_name
        name.gsub(/[^\s\w.-]/, '')
      end

      def path
        safe_name.gsub(/[\s]/, '_')
      end
    end
  end
end