Class: IAuthU::Request
- Inherits:
-
Object
- Object
- IAuthU::Request
- 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
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user, creds, site) ⇒ Request
constructor
A new instance of Request.
- #logger ⇒ Object
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
#debug ⇒ Object
Returns the value of attribute debug.
25 26 27 |
# File 'lib/iauthu/request.rb', line 25 def debug @debug end |
Instance Method Details
#call ⇒ Object
31 32 33 34 35 |
# File 'lib/iauthu/request.rb', line 31 def call logger.info "Sending request for: #{@user.inspect}" token, data = (@user, @creds, @site.shared_secret) invoke_action(site_url, data, token) end |
#logger ⇒ Object
27 28 29 |
# File 'lib/iauthu/request.rb', line 27 def logger CONFIG[:logger] end |