Class: R10K::ModuleRepository::Forge
- Inherits:
-
Object
- Object
- R10K::ModuleRepository::Forge
- Defined in:
- lib/r10k/module_repository/forge.rb
Instance Attribute Summary collapse
- #:conn(: conn) ⇒ Faraday readonly private
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
-
#forge ⇒ Object
readonly
Returns the value of attribute forge.
Instance Method Summary collapse
-
#initialize(forge = 'forge.puppetlabs.com') ⇒ Forge
constructor
A new instance of Forge.
-
#latest_version(module_name) ⇒ String
Query for the newest published version of a module.
-
#versions(module_name) ⇒ Array<String>
Query for all published versions of a module.
Constructor Details
#initialize(forge = 'forge.puppetlabs.com') ⇒ Forge
Returns a new instance of Forge.
19 20 21 22 |
# File 'lib/r10k/module_repository/forge.rb', line 19 def initialize(forge = 'forge.puppetlabs.com') @forge = forge @conn = make_conn end |
Instance Attribute Details
#:conn(: conn) ⇒ Faraday (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 |
# File 'lib/r10k/module_repository/forge.rb', line 17 attr_reader :conn |
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
17 18 19 |
# File 'lib/r10k/module_repository/forge.rb', line 17 def conn @conn end |
#forge ⇒ Object (readonly)
Returns the value of attribute forge.
12 13 14 |
# File 'lib/r10k/module_repository/forge.rb', line 12 def forge @forge end |
Instance Method Details
#latest_version(module_name) ⇒ String
Query for the newest published version of a module
49 50 51 |
# File 'lib/r10k/module_repository/forge.rb', line 49 def latest_version(module_name) versions(module_name).last end |
#versions(module_name) ⇒ Array<String>
Query for all published versions of a module
33 34 35 36 37 38 |
# File 'lib/r10k/module_repository/forge.rb', line 33 def versions(module_name) response = @conn.get("/api/v1/releases.json", {'module' => module_name}) response.body[module_name].map do |version_info| version_info['version'] end end |