heroics 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/lib/heroics/configuration.rb +5 -0
- data/lib/heroics/link.rb +4 -0
- data/lib/heroics/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 778c2c48be2cb463e7af93a70e8e913a36f46494958d3130749a85fa179aac0b
|
4
|
+
data.tar.gz: 692a2e4602bb30636f858dd639984e1ebf2a94afb142729be922fb2b6fcd02b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4df2fb7a4979c4fd01abeecae1958cd1d9f31a40ef3316f01388ce677ca454f9e9ca97e91f534d1673eb27f91cce7953267d2cfc3e23418344adf636e90b6cda
|
7
|
+
data.tar.gz: a859026727b36f4a66920130ce83a3e5f1d1768614dad44ca511232c1484f2621c9a02e38ce3f2877d29d492a967d82a5ff41fb28acfdc8ef95d498a6c0110c3
|
data/CHANGELOG.md
CHANGED
@@ -29,6 +29,7 @@ module Heroics
|
|
29
29
|
@options[:cache] = 'Moneta.new(:Memory)'
|
30
30
|
@options[:default_headers] = {}
|
31
31
|
@options[:rate_throttle] = NullRateLimit
|
32
|
+
@options[:status_codes] = []
|
32
33
|
@ruby_name_replacement_patterns = { /[\s-]+/ => '_' }
|
33
34
|
|
34
35
|
yield self if block_given?
|
@@ -67,5 +68,9 @@ module Heroics
|
|
67
68
|
def rate_throttle=(rate_throttle)
|
68
69
|
@options[:rate_throttle] = rate_throttle
|
69
70
|
end
|
71
|
+
|
72
|
+
def acceptable_status_codes=(status_codes)
|
73
|
+
@options[:status_codes] = status_codes
|
74
|
+
end
|
70
75
|
end
|
71
76
|
end
|
data/lib/heroics/link.rb
CHANGED
@@ -19,6 +19,7 @@ module Heroics
|
|
19
19
|
@default_headers = options[:default_headers] || {}
|
20
20
|
@cache = options[:cache] || {}
|
21
21
|
@rate_throttle = options[:rate_throttle] || Heroics::Configuration.defaults.options[:rate_throttle]
|
22
|
+
@status_codes = options[:status_codes] || Heroics::Configuration.defaults.options[:status_codes]
|
22
23
|
end
|
23
24
|
|
24
25
|
# Make a request to the server.
|
@@ -104,6 +105,9 @@ module Heroics
|
|
104
105
|
|
105
106
|
def request_with_cache(connection, options)
|
106
107
|
options[:expects] << 304
|
108
|
+
@status_codes.each do |code|
|
109
|
+
options[:expects] << code
|
110
|
+
end
|
107
111
|
cache_key = "#{options[:path]}:#{options[:headers].hash}"
|
108
112
|
if options[:method] == :get
|
109
113
|
etag = @cache["etag:#{cache_key}"]
|
data/lib/heroics/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- geemus
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2019-10-
|
12
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|