bearcat 1.5.16 → 1.5.19
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bearcat/api_array.rb +20 -8
- data/lib/bearcat/client_module.rb +1 -1
- data/lib/bearcat/version.rb +1 -1
- data/lib/bearcat.rb +2 -6
- 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: 349200e5b396d03d325a41b8005a62d3dd9f84011bffd24f7a0cdc7a27938d23
|
4
|
+
data.tar.gz: b9a4ffe170514f6d1c65d296ebacc7098fcfd85502be6621941edc91e5dde69f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6da4c3b3c8cc79ae6ef026dd964360af049ab19c6cb6f9b4000a58b6c91cef80a0f9982482f63aa49317eace561a932e555f0508c73625e142003145a1da0dfc
|
7
|
+
data.tar.gz: f7d9050559136046b95ea62aff119048842b92adfb000e1c043f4ee3b9607bbd4cfc232e6e06bc3c1fc6032cd0946f40b79c9692c1fa354cb5a0f6aa6482a53e
|
data/lib/bearcat/api_array.rb
CHANGED
@@ -45,8 +45,12 @@ module Bearcat
|
|
45
45
|
raw_response.env[:method]
|
46
46
|
end
|
47
47
|
|
48
|
-
def [](
|
49
|
-
|
48
|
+
def [](key)
|
49
|
+
if key.is_a?(Numeric)
|
50
|
+
@members[key]
|
51
|
+
else
|
52
|
+
@raw_response.body[key]
|
53
|
+
end
|
50
54
|
end
|
51
55
|
|
52
56
|
def last
|
@@ -127,8 +131,8 @@ module Bearcat
|
|
127
131
|
end
|
128
132
|
end
|
129
133
|
|
130
|
-
def get_page(url, params = {})
|
131
|
-
params[
|
134
|
+
def get_page(url, params = {}, page_size_param: 'per_page')
|
135
|
+
params[page_size_param] = @page_count unless params.key?(page_size_param) || !@page_count
|
132
136
|
|
133
137
|
parsed_url = URI.parse(url)
|
134
138
|
p = parse_url_params(parsed_url)
|
@@ -202,11 +206,19 @@ module Bearcat
|
|
202
206
|
end
|
203
207
|
|
204
208
|
def process_body(response)
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
+
data = response.body
|
210
|
+
if @array_key.is_a?(Proc)
|
211
|
+
data = @array_key.call(data, response)
|
212
|
+
elsif @array_key.present?
|
213
|
+
ak = @array_key
|
214
|
+
ak = ak.split('.') if ak.is_a?(String)
|
215
|
+
ak = Array(ak)
|
216
|
+
data = data.dig(*ak)
|
209
217
|
end
|
218
|
+
|
219
|
+
raise "Response could not be mapped to items" unless data.is_a?(Array)
|
220
|
+
|
221
|
+
self.class.make_indifferent(data)
|
210
222
|
end
|
211
223
|
end
|
212
224
|
end
|
@@ -93,7 +93,7 @@ module Bearcat
|
|
93
93
|
val = val.id if val.respond_to?(:id)
|
94
94
|
val = val['id'].presence || val[:id].presence || val if val.is_a?(Hash)
|
95
95
|
val = val.to_s if val.present?
|
96
|
-
val = URI.
|
96
|
+
val = URI.encode_www_form_component(val) if val.is_a?(String)
|
97
97
|
val
|
98
98
|
end
|
99
99
|
end
|
data/lib/bearcat/version.rb
CHANGED
data/lib/bearcat.rb
CHANGED
@@ -4,8 +4,9 @@ require 'bearcat/client'
|
|
4
4
|
module Bearcat
|
5
5
|
class << self
|
6
6
|
require 'logger'
|
7
|
+
attr_accessor :master_rate_limit
|
7
8
|
attr_writer :rate_limit_min, :rate_limits, :max_sleep_seconds,
|
8
|
-
:min_sleep_seconds, :logger, :
|
9
|
+
:min_sleep_seconds, :logger, :rate_limiter
|
9
10
|
|
10
11
|
def configure
|
11
12
|
yield self if block_given?
|
@@ -27,11 +28,6 @@ module Bearcat
|
|
27
28
|
@max_sleep_seconds ||= 60
|
28
29
|
end
|
29
30
|
|
30
|
-
# @deprecated
|
31
|
-
def master_rate_limit
|
32
|
-
@master_rate_limit ||= false
|
33
|
-
end
|
34
|
-
|
35
31
|
def logger
|
36
32
|
return @logger if defined? @logger
|
37
33
|
@logger = Logger.new(STDOUT)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bearcat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Instructure CustomDev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|