2016-02-16 12:01:39 +01:00
|
|
|
class Github::API
|
|
|
|
|
|
|
|
def self.base_uri
|
|
|
|
'https://api.github.com'
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.latest_release
|
|
|
|
call '/repos/sgmap/tps/releases/latest'
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def self.call(end_point, params = {})
|
|
|
|
RestClient::Resource.new(
|
2016-06-09 12:23:50 +02:00
|
|
|
base_uri+end_point, timeout: 5
|
2016-02-16 12:01:39 +01:00
|
|
|
).get(params: params)
|
2016-06-09 12:23:50 +02:00
|
|
|
rescue RestClient::Forbidden
|
|
|
|
nil
|
2016-02-16 12:01:39 +01:00
|
|
|
end
|
|
|
|
end
|