bridge_api 0.1.46 → 0.1.47
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -2
- data/bridge_api.gemspec +1 -0
- data/lib/bridge_api/client.rb +13 -2
- data/lib/bridge_api/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 33d53dbe69e83c140ece152e38d4b640a952dbe71157d3349d2ec992c00a3cdf
|
4
|
+
data.tar.gz: ce0087b8b507566f1620be38adac6e9dcdc48ac4bf24319616771b381cf0b02d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abf0c52442afe33ed5708c7c70a09e04277c5838244cbf3c5696842f86cdb54716d1740d38c6b4d7cd53cb069531075ab9a79fd03a7ac7088b7c7aa31a05fa24
|
7
|
+
data.tar.gz: 2f1a010419bad863287b118a899484c689b901099a891b1ac40b57a55ec010585b81a6b4f1a5d7aaa6237d2ebc3342662555454daed43b960f71124121fc7979
|
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bridge_api (0.1.
|
4
|
+
bridge_api (0.1.47)
|
5
5
|
faraday (~> 0.9.0)
|
6
6
|
faraday_middleware (>= 0.12.2)
|
7
7
|
footrest (>= 0.5.1)
|
8
8
|
logging (>= 2.2.2)
|
9
|
+
paul_walker (>= 0.1.1)
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
@@ -19,7 +20,7 @@ GEM
|
|
19
20
|
public_suffix (>= 2.0.2, < 4.0)
|
20
21
|
byebug (8.2.5)
|
21
22
|
coderay (1.1.2)
|
22
|
-
concurrent-ruby (1.
|
23
|
+
concurrent-ruby (1.1.1)
|
23
24
|
crack (0.4.3)
|
24
25
|
safe_yaml (~> 1.0.0)
|
25
26
|
diff-lcs (1.3)
|
@@ -43,6 +44,8 @@ GEM
|
|
43
44
|
minitest (5.11.3)
|
44
45
|
multi_json (1.13.1)
|
45
46
|
multipart-post (2.0.0)
|
47
|
+
paul_walker (0.1.1)
|
48
|
+
redis (>= 4.0)
|
46
49
|
pry (0.11.3)
|
47
50
|
coderay (~> 1.1.0)
|
48
51
|
method_source (~> 0.9.0)
|
@@ -51,6 +54,7 @@ GEM
|
|
51
54
|
rack-protection (1.5.5)
|
52
55
|
rack
|
53
56
|
rake (0.9.6)
|
57
|
+
redis (4.0.3)
|
54
58
|
rspec (2.99.0)
|
55
59
|
rspec-core (~> 2.99.0)
|
56
60
|
rspec-expectations (~> 2.99.0)
|
data/bridge_api.gemspec
CHANGED
data/lib/bridge_api/client.rb
CHANGED
@@ -6,6 +6,7 @@ require 'footrest/pagination'
|
|
6
6
|
require 'footrest/follow_redirects'
|
7
7
|
require 'footrest/parse_json'
|
8
8
|
require 'base64'
|
9
|
+
require 'paul_walker'
|
9
10
|
|
10
11
|
module BridgeAPI
|
11
12
|
class Client < Footrest::Client
|
@@ -57,6 +58,7 @@ module BridgeAPI
|
|
57
58
|
def enforce_rate_limits
|
58
59
|
return unless BridgeAPI.enforce_rate_limits && !current_limit.nil?
|
59
60
|
return unless current_limit < BridgeAPI::rate_limit_min
|
61
|
+
BridgeAPI.logger.debug("Current LIMIT: #{current_limit}")
|
60
62
|
tts = ((BridgeAPI.rate_limit_min - current_limit) / 5).ceil
|
61
63
|
tts = BridgeAPI.min_sleep_seconds if tts < BridgeAPI.min_sleep_seconds
|
62
64
|
tts = BridgeAPI.max_sleep_seconds if tts > BridgeAPI.max_sleep_seconds
|
@@ -74,11 +76,20 @@ module BridgeAPI
|
|
74
76
|
end
|
75
77
|
|
76
78
|
def current_limit
|
77
|
-
|
79
|
+
if config[:master_rate_limit]
|
80
|
+
limit = PaulWalker::RateLimit.get(config[:api_key], config[:api_key])
|
81
|
+
limit['current']
|
82
|
+
else
|
83
|
+
BridgeAPI.rate_limits[config[:api_key]]
|
84
|
+
end
|
78
85
|
end
|
79
86
|
|
80
87
|
def current_limit=(value)
|
81
|
-
|
88
|
+
if config[:master_rate_limit]
|
89
|
+
PaulWalker::RateLimit.add(config[:api_key], config[:api_key], value, BridgeAPI::rate_limit_min)
|
90
|
+
else
|
91
|
+
BridgeAPI.rate_limits[config[:api_key]] = value
|
92
|
+
end
|
82
93
|
end
|
83
94
|
|
84
95
|
def set_connection(config)
|
data/lib/bridge_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridge_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.47
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Shaffer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -190,6 +190,20 @@ dependencies:
|
|
190
190
|
- - ">="
|
191
191
|
- !ruby/object:Gem::Version
|
192
192
|
version: 2.2.2
|
193
|
+
- !ruby/object:Gem::Dependency
|
194
|
+
name: paul_walker
|
195
|
+
requirement: !ruby/object:Gem::Requirement
|
196
|
+
requirements:
|
197
|
+
- - ">="
|
198
|
+
- !ruby/object:Gem::Version
|
199
|
+
version: 0.1.1
|
200
|
+
type: :runtime
|
201
|
+
prerelease: false
|
202
|
+
version_requirements: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: 0.1.1
|
193
207
|
description: Ruby gem for interacting with the bridge API
|
194
208
|
email:
|
195
209
|
- jshaffer@instructure.com
|