Class: JayAPI::PriorVersionFetcherBase
- Inherits:
-
Object
- Object
- JayAPI::PriorVersionFetcherBase
- Defined in:
- lib/jay_api/prior_version_fetcher_base.rb
Overview
Fetches the previous software version depending on the given version.
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#initialize(client:, index_name:) ⇒ PriorVersionFetcherBase
constructor
A new instance of PriorVersionFetcherBase.
-
#prior_version(current_version:) ⇒ String?
Calculates the prior software version given the current version if it exists.
Constructor Details
#initialize(client:, index_name:) ⇒ PriorVersionFetcherBase
Returns a new instance of PriorVersionFetcherBase.
15 16 17 18 |
# File 'lib/jay_api/prior_version_fetcher_base.rb', line 15 def initialize(client:, index_name:) @client = client @index_name = index_name end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/jay_api/prior_version_fetcher_base.rb', line 10 def client @client end |
Instance Method Details
#prior_version(current_version:) ⇒ String?
Calculates the prior software version given the current version if it exists.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/jay_api/prior_version_fetcher_base.rb', line 26 def prior_version(current_version:) versions = [] results = index_obj.search(query) results.all do |document| # Since the version is inside an array we have to call first versions << document['fields']['build_properties.version_code.keyword'].first end # This function must be injected by the project-specific fetcher compute_last_version(current_version: current_version, existent_versions: versions) end |