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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5647a8b91b25c77f40182266db987cd58c4f189eae45a70a694ba4d21f736d19
4
- data.tar.gz: 7a723886449d51423484019452f5f22be13bef2874f94d85c90153c7e4b16aa5
3
+ metadata.gz: 778c2c48be2cb463e7af93a70e8e913a36f46494958d3130749a85fa179aac0b
4
+ data.tar.gz: 692a2e4602bb30636f858dd639984e1ebf2a94afb142729be922fb2b6fcd02b1
5
5
  SHA512:
6
- metadata.gz: adfc5e7f5a5159d9264215bcc8496e334535ace0f5b770fb46de19f331a03425423a7c2aee7f21cf990c57aa4a36e724206bd1f280f70e68c0f7d15640930390
7
- data.tar.gz: 75d171e2daf0bc99a5d1d675661684e15f4d128ccb1cc1f02deabddfc56cef955de82bbd85f366e17dd6f915452cd2df2d8d223830f4de0593d6bf149ba76f27
6
+ metadata.gz: 4df2fb7a4979c4fd01abeecae1958cd1d9f31a40ef3316f01388ce677ca454f9e9ca97e91f534d1673eb27f91cce7953267d2cfc3e23418344adf636e90b6cda
7
+ data.tar.gz: a859026727b36f4a66920130ce83a3e5f1d1768614dad44ca511232c1484f2621c9a02e38ce3f2877d29d492a967d82a5ff41fb28acfdc8ef95d498a6c0110c3
@@ -1,4 +1,7 @@
1
+ ## 0.1.1
2
+
3
+ - Add status codes configuration (https://github.com/interagent/heroics/pull/96)
4
+
1
5
  ## 0.1.0
2
6
 
3
7
  - Introduced rate throttling integration point (https://github.com/interagent/heroics/pull/95)
4
-
@@ -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
@@ -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}"]
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Heroics
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
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.0
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-07 00:00:00.000000000 Z
12
+ date: 2019-10-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler