class Sailplay::Configuration
Constants
- DEFAULT_CONNECTION_OPTIONS
- OPTIONS
Attributes
Url prefix for API (defaults to /api)
The host to connect to (defaults to sailplay.ru).
JS client configuration
one of :top_left, :top_right, :center_left, :center_right, :bottom_left, :bottom_right
The port on which Sailplay
API server runs (defaults to 443 for secure connections, 80 for insecure connections).
true
for https connections, false
for http connections.
true
for https connections, false
for http connections.
{
:buttonText => 'Text', :buttonBgGradient => ["#78bb44", "#367300"], :buttonFontSize => '9px', :picUrl => "http://some.url", :bgColor => '#ffffff', :borderColor => '#ffffff', :textColor => '#300c2f', :pointsColor => '#c81750', :buttonTextColor => '#ffffff'
}
Public Class Methods
# File lib/sailplay/configuration.rb, line 51 def initialize @host = 'sailplay.ru' @secure = true @endpoint = '/api' @js_api_path = 'static/js/sailplay.js' @js_position = :top_right @skin = {} @connection_options = DEFAULT_CONNECTION_OPTIONS.dup end
Public Instance Methods
Allows config options to be read like a hash
@param [Symbol] option Key for a given attribute
# File lib/sailplay/configuration.rb, line 67 def [](option) send(option) end
Determines whether protocol should be “http” or “https”. @return [String] Returns +“http”+ if you’ve set secure to false
in configuration, and +“https”+ otherwise.
# File lib/sailplay/configuration.rb, line 86 def protocol if secure? 'https' else 'http' end end
Returns a hash of all configurable options
# File lib/sailplay/configuration.rb, line 72 def to_hash OPTIONS.inject({}) do |hash, option| hash[option.to_sym] = self.send(option) hash end end
Private Instance Methods
Determines what port should we use for sending notices. @return [Fixnum] Returns 443 if you’ve set secure to true in your configuration, and 80 otherwise.
# File lib/sailplay/configuration.rb, line 107 def default_port if secure? 443 else 80 end end