Fix bug get Forbidden last version github
This commit is contained in:
parent
e72487bb28
commit
3c75fb27c4
3 changed files with 14 additions and 6 deletions
|
@ -58,10 +58,14 @@
|
|||
|
||||
.row.word.news
|
||||
.latest_release.col-md-7.col-lg-7
|
||||
%h3.text-info
|
||||
= "Dernière version (#{@latest_release.tag_name} - #{@latest_release.published_at})"
|
||||
.body
|
||||
=@latest_release.body.html_safe
|
||||
- if @latest_release.nil?
|
||||
%p
|
||||
Erreur dans la récupération des données
|
||||
-else
|
||||
%h3.text-info
|
||||
= "Dernière version (#{@latest_release.tag_name} - #{@latest_release.published_at})"
|
||||
.body
|
||||
=@latest_release.body.html_safe
|
||||
|
||||
.center
|
||||
\-
|
||||
|
|
|
@ -12,7 +12,9 @@ class Github::API
|
|||
|
||||
def self.call(end_point, params = {})
|
||||
RestClient::Resource.new(
|
||||
base_uri+end_point
|
||||
base_uri+end_point, timeout: 5
|
||||
).get(params: params)
|
||||
rescue RestClient::Forbidden
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,8 +2,10 @@ class Github::Releases
|
|||
|
||||
def self.latest
|
||||
release = Hashie::Mash.new JSON.parse(Github::API.latest_release)
|
||||
release.published_at = release.published_at.to_date.strftime('%d/%m/%Y')
|
||||
|
||||
return nil if release.nil?
|
||||
|
||||
release.published_at = release.published_at.to_date.strftime('%d/%m/%Y')
|
||||
release
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue