amp_helper 1.0.0.pre.1 → 1.0.0.pre.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1fd42d6d1ead9832928bf7f30ba7312e7369bc9
4
- data.tar.gz: c2dc138af979eeb3a2c58ef33e41a45b075c59fb
3
+ metadata.gz: de14bc07af417ab4acea00331539edcdd94cab90
4
+ data.tar.gz: b98de58c842a75f6e6e3d0187bd4d3eaa36ed3b2
5
5
  SHA512:
6
- metadata.gz: d0f31e5602cddba8532909293ca4d9567aef745e73a0cf9caf4b289f8ae717b325386001f2bd4725b3acd636d562d72266b34e19c6a94a47026036ffc3ba3112
7
- data.tar.gz: 7fce0a40a5d7a9ace07c7dfc5e66acd4f636fb07fc3a7a0fa322be2837527f7bc50af1b80fc7fef86cca7b5fd124edabcffec935d3bbd05930c2e2930f41c0a3
6
+ metadata.gz: 40e1bd870f0d6dbbd001635e0105271271cba581241a8da96d38672e915aa57d2b1463cd3b0c933ec83de39d7e7a4ba2862384d02e1ebccf6f459e604f962531
7
+ data.tar.gz: 32182d37459945c0fef8f06f343792979d0a19f7bcf8491896ab732f47f87b7d9af6847feb199bbe395299a72a2a2c2db5b8d6afe56a5b8c90f0165c67bc3034
@@ -30,10 +30,11 @@ module AmpLinkToHelper
30
30
  identify += "#{request.host}#{uri.path}#{uri.query}"
31
31
  escaped_host = request.host.gsub('-', '--').gsub('.', '-')
32
32
  cache_url = "https://#{escaped_host}.cdn.ampproject.org/c/#{identify}"
33
- response_200?(cache_url) ? cache_url : uri.to_s
33
+ validate_amp_cache(cache_url) ? cache_url : uri.to_s
34
34
  end
35
35
 
36
- def response_200?(url)
36
+ def validate_amp_cache(url)
37
+ return true unless AmpHelper.configuration.confirm_cache_exist
37
38
  Net::HTTP.get_response(URI(url)).code == '200'
38
39
  end
39
40
  end
@@ -9,12 +9,14 @@ module AmpHelper
9
9
  end
10
10
 
11
11
  class Configuration
12
- attr_accessor :enable_amp_image, :format_2x, :enable_amp_link
12
+ attr_accessor :enable_amp_image, :format_2x, :enable_amp_link,
13
+ :confirm_cache_exist
13
14
 
14
15
  def initialize
15
16
  @enable_amp_image = true
16
17
  @format_2x = nil
17
18
  @enable_amp_link = true
19
+ @confirm_cache_exist = false
18
20
  end
19
21
  end
20
22
  end
@@ -1,3 +1,3 @@
1
1
  module AmpHelper
2
- VERSION = '1.0.0.pre.1'
2
+ VERSION = '1.0.0.pre.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amp_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.1
4
+ version: 1.0.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Awjecc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-30 00:00:00.000000000 Z
11
+ date: 2017-01-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler