Class: IAuthU::Site
- Inherits:
-
Object
- Object
- IAuthU::Site
- Defined in:
- lib/iauthu/site.rb
Overview
IAuthU::Site represents your remote ITunesU site.
site = IAuthU::Site.build {
url "https://deimos.apple.com/WebObjects/Core.woa/Browse/montana.edu"
debug_suffix "/aqc392"
shared_secret "WQBMFYFFH7SBPVFXMCEBG43WC2ANW7LQ"
cred :admin, "Administrator\@urn:mace:itunesu.com:sites:montana.edu"
cred :user, "Authenticated\@urn:mace:itunesu.com:sites:montana.edu"
}
Defined Under Namespace
Classes: Builder, SettingsError
Instance Attribute Summary collapse
-
#credentials ⇒ Object
Returns the value of attribute credentials.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#debug_suffix ⇒ Object
Returns the value of attribute debug_suffix.
-
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
Instance Method Summary collapse
- #authentication_request(user) ⇒ Object
-
#initialize(opts = {}) ⇒ Site
constructor
A new instance of Site.
- #logger ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Site
Returns a new instance of Site.
23 24 25 26 27 |
# File 'lib/iauthu/site.rb', line 23 def initialize(opts={}) @debug = false opts = {:url => "", :debug_suffix => "", :shared_secret => "", :credentials => {}}.merge(opts) opts.keys.each{|var| instance_variable_set "@#{var.to_s}", opts[var]} end |
Instance Attribute Details
#credentials ⇒ Object
Returns the value of attribute credentials.
28 29 30 |
# File 'lib/iauthu/site.rb', line 28 def credentials @credentials end |
#debug ⇒ Object
Returns the value of attribute debug.
28 29 30 |
# File 'lib/iauthu/site.rb', line 28 def debug @debug end |
#debug_suffix ⇒ Object
Returns the value of attribute debug_suffix.
28 29 30 |
# File 'lib/iauthu/site.rb', line 28 def debug_suffix @debug_suffix end |
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
28 29 30 |
# File 'lib/iauthu/site.rb', line 28 def shared_secret @shared_secret end |
#url ⇒ Object
Returns the value of attribute url.
28 29 30 |
# File 'lib/iauthu/site.rb', line 28 def url @url end |
Class Method Details
Instance Method Details
#authentication_request(user) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/iauthu/site.rb', line 34 def authentication_request(user) raise SettingsError, "Site url must be set before sending request." unless url && !url.empty? user = user.clone creds = user.delete("credentials") || [] tmp = [] creds.each{|c| tmp << credentials[c]} begin req = Request.new(user, tmp, self) rescue Request::MissingCredentialsError raise MissingCredentialsError, "Credentials entry is missing in: #{user.inspect}" end req.debug = debug req end |
#logger ⇒ Object
30 31 32 |
# File 'lib/iauthu/site.rb', line 30 def logger CONFIG[:logger] end |