module StreamRails
Provides a shortcut from views to the rendering method.
Constants
- VERSION
Attributes
logger[RW]
Public Class Methods
client()
click to toggle source
# File lib/stream_rails.rb, line 16 def self.client Stream::Client.new( config.api_key, config.api_secret, config.api_site_id, location: config.location, default_timeout: config.timeout, api_hostname: config.api_hostname ) end
config()
click to toggle source
Returns StreamRails's configuration object.
# File lib/stream_rails.rb, line 28 def self.config @config ||= StreamRails::Config.new end
configure() { |config| ... }
click to toggle source
Lets you set global configuration options.
All available options and their defaults are in the example below: @example Initializer for Rails
StreamRails.configure do |config| config.api_key = "key" config.api_secret = "secret" config.api_site_id = "42" config.location = "us-east" config.api_hostname = "stream-io-api.com" config.enabled = true end
# File lib/stream_rails.rb, line 62 def self.configure(&_block) yield(config) if block_given? end
create_reference(record)
click to toggle source
# File lib/stream_rails/activity.rb, line 6 def create_reference(record) if record.is_a?(ActiveRecord::Base) || record.is_a?(Sequel::Model) "#{record.class.model_name}:#{record.id}" else record&.to_s end end
enabled=(value)
click to toggle source
Switches StreamRails
on or off. @param value [Boolean]
# File lib/stream_rails.rb, line 34 def self.enabled=(value) StreamRails.config.enabled = value end
enabled?()
click to toggle source
Returns `true` if StreamRails
is on, `false` otherwise. Enabled by default. @return [Boolean]
# File lib/stream_rails.rb, line 41 def self.enabled? StreamRails.config.enabled end
feed_manager()
click to toggle source
Returns StreamRails's configuration object.
# File lib/stream_rails.rb, line 46 def self.feed_manager @feed_manager ||= StreamRails::FeedManager.new(client, config.feed_configs) end