class GemOutdated::RubygemsAPI
Constants
- API_ENDPOINT
- GemNotFound
Attributes
gem_name[R]
Public Class Methods
new(gem_name)
click to toggle source
# File lib/gem_outdated/rubygems_api.rb, line 9 def initialize(gem_name) @gem_name = gem_name gem_exists? end
Public Instance Methods
latest_version()
click to toggle source
# File lib/gem_outdated/rubygems_api.rb, line 15 def latest_version endpoint = File.join(API_ENDPOINT, "versions", gem_name, "latest.json") HTTP.get(endpoint).parse["version"] end
Private Instance Methods
gem_exists?()
click to toggle source
# File lib/gem_outdated/rubygems_api.rb, line 25 def gem_exists? endpoint = File.join(API_ENDPOINT, "gems", "#{gem_name}.json") code = HTTP.get(endpoint).code code == 404 ? raise(GemNotFound) : true end