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
|
.row.word.news
|
||||||
.latest_release.col-md-7.col-lg-7
|
.latest_release.col-md-7.col-lg-7
|
||||||
%h3.text-info
|
- if @latest_release.nil?
|
||||||
= "Dernière version (#{@latest_release.tag_name} - #{@latest_release.published_at})"
|
%p
|
||||||
.body
|
Erreur dans la récupération des données
|
||||||
=@latest_release.body.html_safe
|
-else
|
||||||
|
%h3.text-info
|
||||||
|
= "Dernière version (#{@latest_release.tag_name} - #{@latest_release.published_at})"
|
||||||
|
.body
|
||||||
|
=@latest_release.body.html_safe
|
||||||
|
|
||||||
.center
|
.center
|
||||||
\-
|
\-
|
||||||
|
|
|
@ -12,7 +12,9 @@ class Github::API
|
||||||
|
|
||||||
def self.call(end_point, params = {})
|
def self.call(end_point, params = {})
|
||||||
RestClient::Resource.new(
|
RestClient::Resource.new(
|
||||||
base_uri+end_point
|
base_uri+end_point, timeout: 5
|
||||||
).get(params: params)
|
).get(params: params)
|
||||||
|
rescue RestClient::Forbidden
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,8 +2,10 @@ class Github::Releases
|
||||||
|
|
||||||
def self.latest
|
def self.latest
|
||||||
release = Hashie::Mash.new JSON.parse(Github::API.latest_release)
|
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
|
release
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue