Class: GH::CustomLimit
Overview
Adds Client info so even unauthenticated requests can use a custom request limit
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
Attributes inherited from Wrapper
Instance Method Summary collapse
Methods inherited from Wrapper
[], #[], #frontend, #frontend=, #generate_response, #initialize, #inspect, #load, #prefixed, #reset, wraps
Constructor Details
This class inherits a constructor from GH::Wrapper
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
4 5 6 |
# File 'lib/gh/custom_limit.rb', line 4 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
4 5 6 |
# File 'lib/gh/custom_limit.rb', line 4 def client_secret @client_secret end |
Instance Method Details
#full_url(key) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gh/custom_limit.rb', line 12 def full_url(key) return super unless client_id url = super params = url.query_values || {} unless params.include? 'client_id' params['client_id'] = client_id params['client_secret'] = client_secret end url.query_values = params url end |
#setup(backend, options) ⇒ Object
6 7 8 9 10 |
# File 'lib/gh/custom_limit.rb', line 6 def setup(backend, ) @client_id = [:client_id] @client_secret = [:client_secret] super end |