Class: BulkImports::SourceUrlBuilder
- Inherits:
-
Object
- Object
- BulkImports::SourceUrlBuilder
- Defined in:
- lib/bulk_imports/source_url_builder.rb
Constant Summary collapse
- ALLOWED_RELATIONS =
%w[ issues merge_requests epics milestones ].freeze
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#entry ⇒ Object
readonly
Returns the value of attribute entry.
Instance Method Summary collapse
-
#initialize(context, entry) ⇒ SourceUrlBuilder
constructor
A new instance of SourceUrlBuilder.
-
#url ⇒ Object
Builds a source URL for the given entry if iid is present.
Constructor Details
#initialize(context, entry) ⇒ SourceUrlBuilder
Returns a new instance of SourceUrlBuilder.
16 17 18 19 20 |
# File 'lib/bulk_imports/source_url_builder.rb', line 16 def initialize(context, entry) @context = context @entity = context.entity @entry = entry end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
12 13 14 |
# File 'lib/bulk_imports/source_url_builder.rb', line 12 def context @context end |
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
12 13 14 |
# File 'lib/bulk_imports/source_url_builder.rb', line 12 def entity @entity end |
#entry ⇒ Object (readonly)
Returns the value of attribute entry.
12 13 14 |
# File 'lib/bulk_imports/source_url_builder.rb', line 12 def entry @entry end |
Instance Method Details
#url ⇒ Object
Builds a source URL for the given entry if iid is present
23 24 25 26 27 28 29 |
# File 'lib/bulk_imports/source_url_builder.rb', line 23 def url return unless entry.is_a?(ApplicationRecord) return unless iid return unless ALLOWED_RELATIONS.include?(relation) File.join(source_instance_url, group_prefix, source_full_path, '-', relation, iid.to_s) end |