Class: ForemanGitTemplates::RepositoryFetcher
- Inherits:
-
Object
- Object
- ForemanGitTemplates::RepositoryFetcher
- Defined in:
- app/services/foreman_git_templates/repository_fetcher.rb
Defined Under Namespace
Classes: RepositoryFetcherError
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(repository_url) ⇒ RepositoryFetcher
constructor
A new instance of RepositoryFetcher.
Constructor Details
#initialize(repository_url) ⇒ RepositoryFetcher
Returns a new instance of RepositoryFetcher.
7 8 9 |
# File 'app/services/foreman_git_templates/repository_fetcher.rb', line 7 def initialize(repository_url) @repository_url = repository_url end |
Class Method Details
.call(repository_url) ⇒ Object
19 20 21 |
# File 'app/services/foreman_git_templates/repository_fetcher.rb', line 19 def self.call(repository_url) new(repository_url).call end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 |
# File 'app/services/foreman_git_templates/repository_fetcher.rb', line 11 def call Down.download(repository_url) rescue Down::ResponseError => e raise RepositoryFetcherError, "Cannot fetch repository from #{repository_url}. Response code: #{e.response.code}" rescue Down::Error => e raise RepositoryFetcherError, "Cannot fetch repository from #{repository_url}, #{e.}" end |