Class: PollEverywhere::Configuration

Inherits:
Object
  • Object
show all
Includes:
Configurable
Defined in:
lib/polleverywhere/configuration.rb

Overview

Configuration information for the Poll Everywhere gem.

Instance Method Summary collapse

Methods included from Configurable

included

Constructor Details

#initializeConfiguration

Setup default values for configuration class as instance variables.


11
12
13
14
# File 'lib/polleverywhere/configuration.rb', line 11

def initialize
  self.url = "https://www.polleverywhere.com"
  self.http_adapter = :sync
end

Instance Method Details

#http_adapter=(name) ⇒ Object

Setup the HTTP adapter that will execute HTTP requests.


22
23
24
# File 'lib/polleverywhere/configuration.rb', line 22

def http_adapter=(name)
  @http_adapter = HTTP.adapter(name.to_sym)
end

#http_basic_credentialsObject

Builds an HTTP Basic header for our authentication. Eventually this form of authorization will be replaced with a token authorization so that a password is not required.


29
30
31
# File 'lib/polleverywhere/configuration.rb', line 29

def http_basic_credentials
  "Basic #{Base64.encode64("#{username}:#{password}")}".chomp
end

#url=(val) ⇒ Object

Make sure that a set URL is always an URI object.


17
18
19
# File 'lib/polleverywhere/configuration.rb', line 17

def url=(val)
  @url = URI.parse(val)
end