class GemMonitor::Service
Constants
- BASE_URL
- VERSIONS_ENDPOINT
Public Class Methods
get_latest_version_for(gem_name)
click to toggle source
TODO: create an oject to handle this response
# File lib/gem_monitor/service.rb, line 12 def self.get_latest_version_for gem_name begin response = RestClient.get("#{BASE_URL}#{VERSIONS_ENDPOINT}#{gem_name}/latest.json") JSON.parse(response.body).fetch("version") rescue RestClient::Exception => e "unknown" rescue JSON::ParserError => e raise GemMonitor::Error.new("Error parsing response please submit an issue on #{GemMonitor.issues_url} along the response #{response.body}") end end