Class: Packages::Nuget::SearchService
- Inherits:
-
BaseService
- Object
- BaseService
- Packages::Nuget::SearchService
- Includes:
- ActiveRecord::ConnectionAdapters::Quoting, Gitlab::Utils::StrongMemoize
- Defined in:
- app/services/packages/nuget/search_service.rb
Constant Summary collapse
- MAX_PER_PAGE =
30
- MAX_VERSIONS_PER_PACKAGE =
10
- PRE_RELEASE_VERSION_MATCHING_TERM =
'%-%'
- DEFAULT_OPTIONS =
{ include_prerelease_versions: true, per_page: Kaminari.config.default_per_page, padding: 0 }.freeze
Instance Attribute Summary
Attributes inherited from BaseService
#current_user, #params, #project
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(project, search_term, options = {}) ⇒ SearchService
constructor
A new instance of SearchService.
Methods included from Gitlab::Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Methods included from BaseServiceUtility
#deny_visibility_level, #event_service, #log_error, #log_info, #notification_service, #system_hook_service, #todo_service, #visibility_level
Methods included from Gitlab::Allowable
Constructor Details
#initialize(project, search_term, options = {}) ⇒ SearchService
Returns a new instance of SearchService.
19 20 21 22 23 24 25 26 |
# File 'app/services/packages/nuget/search_service.rb', line 19 def initialize(project, search_term, = {}) @project = project @search_term = search_term @options = DEFAULT_OPTIONS.merge() raise ArgumentError, 'negative per_page' if per_page < 0 raise ArgumentError, 'negative padding' if padding < 0 end |
Instance Method Details
#execute ⇒ Object
28 29 30 31 32 33 |
# File 'app/services/packages/nuget/search_service.rb', line 28 def execute OpenStruct.new( total_count: package_names.total_count, results: search_packages ) end |