-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
124 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
.btn { | ||
// All the previous code | ||
|
||
&--primary { | ||
color: var(--color-white); | ||
background-image: linear-gradient(to right, var(--color-primary), var(--color-primary-rotate)); | ||
|
||
&:hover, | ||
&:focus, | ||
&:focus-within, | ||
&:active { | ||
color: var(--color-white); | ||
filter: saturate(1.4) brightness(115%); | ||
} | ||
} | ||
|
||
&--secondary { | ||
color: var(--color-white); | ||
background-image: linear-gradient(to right, var(--color-secondary), var(--color-secondary-rotate)); | ||
|
||
&:hover, | ||
&:focus, | ||
&:focus-within, | ||
&:active { | ||
color: var(--color-white); | ||
filter: saturate(1.2) brightness(110%); | ||
} | ||
} | ||
|
||
&--light { | ||
color: var(--color-dark); | ||
background-color: var(--color-light); | ||
|
||
&:hover, | ||
&:focus, | ||
&:focus-within, | ||
&:active { | ||
color: var(--color-dark); | ||
filter: brightness(92%); | ||
} | ||
} | ||
|
||
&--dark { | ||
color: var(--color-white); | ||
border-color: var(--color-dark); | ||
background-color: var(--color-dark); | ||
|
||
&:hover, | ||
&:focus, | ||
&:focus-within, | ||
&:active { | ||
color: var(--color-white); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
module HTTPRequestsHelper | ||
def self.make_request(source: nil, url: nil) | ||
connection = Faraday.new( | ||
url: source&.url || url, | ||
headers: { | ||
'If-Modified-Since': source&.last_modified, | ||
'If-None-Match': source&.etag, | ||
'User-Agent': 'Mozilla/5.0 (X11; Linux i686; rv:127.0) Gecko/20100101 Firefox/127.0' | ||
}, | ||
ssl: { verify: false } | ||
) do |faraday| | ||
faraday.use FaradayMiddleware::FollowRedirects | ||
faraday.adapter :net_http # not sure if this is needed/helpful | ||
end | ||
|
||
response = connection.get | ||
|
||
if response.status == 500 | ||
source.update(last_error_status: 'Internal Server Error (500)') if source | ||
end | ||
|
||
response | ||
|
||
rescue Faraday::ConnectionFailed => e | ||
puts source.name if source | ||
puts source.url if source | ||
puts e | ||
puts "URL DIDN'T WORK" | ||
source.update(last_error_status: 'connection_failed') if source | ||
return | ||
rescue URI::InvalidURIError => e | ||
puts source.name if source | ||
puts source.url if source | ||
puts e | ||
puts 'INVALID URL' | ||
source.update(last_error_status: 'invalid_url') if source | ||
return | ||
rescue Faraday::SSLError => e | ||
puts source.name if source | ||
puts source.url if source | ||
puts e | ||
puts 'SSL ERROR' | ||
source.update(last_error_status: 'ssl_error') if source | ||
return | ||
rescue Faraday::TimeoutError => e | ||
puts source.name if source | ||
puts source.url if source | ||
puts e | ||
puts 'TIMEOUT ERROR' | ||
source.update(last_error_status: 'timeout') if source | ||
return | ||
rescue FaradayMiddleware::RedirectLimitReached => e | ||
puts source.name if source | ||
puts source.url if source | ||
puts e | ||
puts 'REDIRECT LIMIT REACHED' | ||
source.update(last_error_status: 'redirect_limit_reached') if source | ||
return | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters