Module: Bearcat

Defined in:
lib/bearcat/redis_connection.rb,
lib/bearcat.rb,
lib/bearcat/client.rb,
lib/bearcat/version.rb,
lib/bearcat/api_array.rb,
lib/bearcat/client/tabs.rb,
lib/bearcat/client/files.rb,
lib/bearcat/client/pages.rb,
lib/bearcat/client/roles.rb,
lib/bearcat/client/users.rb,
lib/bearcat/client/groups.rb,
lib/bearcat/client/logins.rb,
lib/bearcat/client/rubric.rb,
lib/bearcat/client/search.rb,
lib/bearcat/client_module.rb,
lib/bearcat/rate_limiting.rb,
lib/bearcat/client/courses.rb,
lib/bearcat/client/folders.rb,
lib/bearcat/client/modules.rb,
lib/bearcat/client/o_auth2.rb,
lib/bearcat/client/quizzes.rb,
lib/bearcat/client/reports.rb,
lib/bearcat/client/accounts.rb,
lib/bearcat/client/graph_ql.rb,
lib/bearcat/client/outcomes.rb,
lib/bearcat/client/sections.rb,
lib/bearcat/client/analytics.rb,
lib/bearcat/client/progresses.rb,
lib/bearcat/client/assignments.rb,
lib/bearcat/client/conferences.rb,
lib/bearcat/client/discussions.rb,
lib/bearcat/client/enrollments.rb,
lib/bearcat/client/file_helper.rb,
lib/bearcat/client/sis_imports.rb,
lib/bearcat/client/submissions.rb,
lib/bearcat/client/canvas_files.rb,
lib/bearcat/client/module_items.rb,
lib/bearcat/client/conversations.rb,
lib/bearcat/client/external_tools.rb,
lib/bearcat/client/outcome_groups.rb,
lib/bearcat/client/account_reports.rb,
lib/bearcat/client/calendar_events.rb,
lib/bearcat/client/content_exports.rb,
lib/bearcat/client/outcome_imports.rb,
lib/bearcat/client/group_categories.rb,
lib/bearcat/client/assignment_groups.rb,
lib/bearcat/client/blueprint_courses.rb,
lib/bearcat/client/group_memberships.rb,
lib/bearcat/client/learning_outcomes.rb,
lib/bearcat/client/rubric_assessment.rb,
lib/bearcat/client/content_migrations.rb,
lib/bearcat/client/rubric_association.rb,
lib/bearcat/rate_limiting/redis_script.rb,
lib/bearcat/client/account_notifications.rb,
lib/bearcat/client/custom_gradebook_columns.rb

Overview

Defined Under Namespace

Modules: RateLimiting, RedisConnection, SpecHelpers Classes: ApiArray, Client, ExtendedRaiseFootrestErrors

Constant Summary collapse

VERSION =
'1.5.32'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject



32
33
34
35
36
37
# File 'lib/bearcat.rb', line 32

def logger
  return @logger if defined? @logger
  @logger = Logger.new(STDOUT)
  @logger.level = Logger::DEBUG
  @logger
end

.master_rate_limitObject

Returns the value of attribute master_rate_limit.



8
9
10
# File 'lib/bearcat.rb', line 8

def master_rate_limit
  @master_rate_limit
end

.max_sleep_secondsObject



28
29
30
# File 'lib/bearcat.rb', line 28

def max_sleep_seconds
  @max_sleep_seconds ||= 60
end

.min_sleep_secondsObject



24
25
26
# File 'lib/bearcat.rb', line 24

def min_sleep_seconds
  @min_sleep_seconds ||= 5
end

.rate_limit_minObject



20
21
22
# File 'lib/bearcat.rb', line 20

def rate_limit_min
  @rate_limit_min ||= 175
end

.rate_limiterObject



16
17
18
# File 'lib/bearcat.rb', line 16

def rate_limiter
  @rate_limiter
end

.rate_limits=(value) ⇒ Object (writeonly)

Sets the attribute rate_limits

Parameters:

  • value

    the value to set the attribute rate_limits to.



9
10
11
# File 'lib/bearcat.rb', line 9

def rate_limits=(value)
  @rate_limits = value
end

Class Method Details

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (Bearcat)

    the object that the method was called on



12
13
14
# File 'lib/bearcat.rb', line 12

def configure
  yield self if block_given?
end

.redisObject

Raises:

  • (ArgumentError)


44
45
46
47
48
49
# File 'lib/bearcat.rb', line 44

def redis
  raise ArgumentError, "requires a block" unless block_given?
  redis_pool.with do |conn|
    yield conn
  end
end

.redis_poolObject



39
40
41
42
# File 'lib/bearcat.rb', line 39

def redis_pool
  require 'bearcat/redis_connection'
  @redis_pool ||= Bearcat::RedisConnection.create(env_prefix: "BEARCAT")
end