Class: IAuthU::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/iauthu/request.rb

Overview

IAuthU::Request performs the ITunesU authentication step. Usually you will

not create a Request object manually, but will instead recieve it from
a Site object. A Request object defers the actual connection to ITunesU
until the #call method is invoked.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, creds, site) ⇒ Request

Returns a new instance of Request.



17
18
19
20
21
22
23
# File 'lib/iauthu/request.rb', line 17

def initialize(user, creds, site)
  @user = user
  @creds = creds.to_a
  #raise MissingCredentialsError, "Credentials cannot be empty." if @creds.empty?
  @site = site
  @debug = false
end

Instance Attribute Details

#debugObject

Returns the value of attribute debug.



25
26
27
# File 'lib/iauthu/request.rb', line 25

def debug
  @debug
end

Instance Method Details

#callObject



31
32
33
34
35
# File 'lib/iauthu/request.rb', line 31

def call
  logger.info "Sending request for: #{@user.inspect}"
  token, data = get_authorization_token(@user, @creds, @site.shared_secret)
  invoke_action(site_url, data, token)
end

#loggerObject



27
28
29
# File 'lib/iauthu/request.rb', line 27

def logger
  CONFIG[:logger]
end